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>

Junio C Hamano committed May 3, 2012 at 15:12 UTC 663c1295d8a6a591a805692d311e1d709e3193e2
1 file changed +3 -1
refs.c
+3 -1
@@ -390,8 +390,10 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
390 refname + dirname.len,
391 (slash + 1) - (refname + dirname.len));
392 subdir = search_for_subdir(dir, dirname.buf, mkdir);
393 - if (!subdir)
393 + if (!subdir) {
394 + dir = NULL;
395 break;
396 + }
397 dir = subdir;
398 }
399