Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 663c129

Browse files
committed
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 <[email protected]>
1 parent 28e6a34 commit 663c129

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

refs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,10 @@ static struct ref_dir *find_containing_dir(struct ref_dir *dir,
390390
refname + dirname.len,
391391
(slash + 1) - (refname + dirname.len));
392392
subdir = search_for_subdir(dir, dirname.buf, mkdir);
393-
if (!subdir)
393+
if (!subdir) {
394+
dir = NULL;
394395
break;
396+
}
395397
dir = subdir;
396398
}
397399

0 commit comments

Comments
 (0)