summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-03-06 15:44:48 -0800
committerJunio C Hamano <gitster@pobox.com>2008-03-09 00:43:47 -0800
commitbcbe5a515e837873f24dc9a764fa31e3ade45bb5 (patch)
tree8f32dd713d0b8a6798795632aba83cac6f8424d2 /tree-walk.c
parent01904572a5cf869983fab454f552542f16b1fe1f (diff)
downloadgit-bcbe5a515e837873f24dc9a764fa31e3ade45bb5.tar.gz
Fix tree-walking compare_entry() in the presense of --prefix
When we make the "root" tree-walk info entry have a pathname in it, we need to have a ->prev pointer so that compare_entry will actually notice and traverse into the root. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tree-walk.c b/tree-walk.c
index 842cb6ad2e..02e2aed773 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -107,6 +107,7 @@ int tree_entry(struct tree_desc *desc, struct name_entry *entry)
void setup_traverse_info(struct traverse_info *info, const char *base)
{
int pathlen = strlen(base);
+ static struct traverse_info dummy;
memset(info, 0, sizeof(*info));
if (pathlen && base[pathlen-1] == '/')
@@ -114,6 +115,8 @@ void setup_traverse_info(struct traverse_info *info, const char *base)
info->pathlen = pathlen ? pathlen + 1 : 0;
info->name.path = base;
info->name.sha1 = (void *)(base + pathlen + 1);
+ if (pathlen)
+ info->prev = &dummy;
}
char *make_traverse_path(char *path, const struct traverse_info *info, const struct name_entry *n)