X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=diff-tree.c;h=59d12f2ba1325bad77dd062936c20cd9cc4d602f;hb=850e82d889f374465dc7aa6cb4af3098c7e02f1f;hp=3bc7480944037e1c0964217d35b5f1014e4f43fd;hpb=cb6c8ed2fea4515ee876c40a2bbd5541e24fc12b;p=git.git diff --git a/diff-tree.c b/diff-tree.c index 3bc74809..59d12f2b 100644 --- a/diff-tree.c +++ b/diff-tree.c @@ -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) @@ -212,6 +204,8 @@ static int interesting(void *tree, unsigned long size, const char *base) if (matchlen > pathlen) { if (match[pathlen] != '/') continue; + if (!S_ISDIR(mode)) + continue; } if (strncmp(path, match, pathlen)) @@ -222,6 +216,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) {