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:
parent
28e6a34e25
commit
663c1295d8
4
refs.c
4
refs.c
@ -390,8 +390,10 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
|
|||||||
refname + dirname.len,
|
refname + dirname.len,
|
||||||
(slash + 1) - (refname + dirname.len));
|
(slash + 1) - (refname + dirname.len));
|
||||||
subdir = search_for_subdir(dir, dirname.buf, mkdir);
|
subdir = search_for_subdir(dir, dirname.buf, mkdir);
|
||||||
if (!subdir)
|
if (!subdir) {
|
||||||
|
dir = NULL;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
dir = subdir;
|
dir = subdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user