Skip to content

Commit

Permalink
refs: fix find_containing_dir() regression
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed May 4, 2012
1 parent 28e6a34 commit 663c129
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 663c129

Please sign in to comment.