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>
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;
}