From: Junio C Hamano Date: Thu, 3 May 2012 22:12:54 +0000 (-0700) Subject: refs: fix find_containing_dir() regression X-Git-Tag: v1.7.11-rc0~49^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=663c1295d8a6a591a805692d311e1d709e3193e2;p=git.git 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 --- diff --git a/refs.c b/refs.c index 9f2da1664..af5da5f1c 100644 --- a/refs.c +++ b/refs.c @@ -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; }