summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--refs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 9f2da16642..af5da5f1c1 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;
}