refs: fix find_containing_dir() regression

The function used to return NULL when asked to find the containing
directory for a ref that does not exist, allowing the caller to
omit iteration altogether. But a misconversion in an earlier change
"refs.c: extract function search_for_subdir()" started returning the
top-level directory entry, forcing callers to walk everything.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2012-05-03 15:12:54 -07:00
parent 28e6a34e25
commit 663c1295d8

4
refs.c
View file

@ -390,8 +390,10 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
refname + dirname.len,
(slash + 1) - (refname + dirname.len));
subdir = search_for_subdir(dir, dirname.buf, mkdir);
if (!subdir)
if (!subdir) {
dir = NULL;
break;
}
dir = subdir;
}