Skip to content

Commit

Permalink
diff-tree: fix "whole sub-tree disappeared or appeared" case
Browse files Browse the repository at this point in the history
We still need to check which part of the sub-tree is interesting.
  • Loading branch information
Linus Torvalds committed May 18, 2005
1 parent cb6c8ed commit ed1a368
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions diff-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,7 @@ static char *malloc_base(const char *base, const char *path, int pathlen)
}

static void show_file(const char *prefix, void *tree, unsigned long size, const char *base);

/* A whole sub-tree went away or appeared */
static void show_tree(const char *prefix, void *tree, unsigned long size, const char *base)
{
while (size) {
show_file(prefix, tree, size, base);
update_tree_entry(&tree, &size);
}
}
static void show_tree(const char *prefix, void *tree, unsigned long size, const char *base);

/* A file entry went away or appeared */
static void show_file(const char *prefix, void *tree, unsigned long size, const char *base)
Expand Down Expand Up @@ -222,6 +214,16 @@ static int interesting(void *tree, unsigned long size, const char *base)
return 0; /* No matches */
}

/* A whole sub-tree went away or appeared */
static void show_tree(const char *prefix, void *tree, unsigned long size, const char *base)
{
while (size) {
if (interesting(tree, size, base))
show_file(prefix, tree, size, base);
update_tree_entry(&tree, &size);
}
}

static int diff_tree(void *tree1, unsigned long size1, void *tree2, unsigned long size2, const char *base)
{
while (size1 | size2) {
Expand Down

0 comments on commit ed1a368

Please sign in to comment.