}
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)
if (pathlen > matchlen)
continue;
+ if (matchlen > pathlen) {
+ if (match[pathlen] != '/')
+ continue;
+ if (!S_ISDIR(mode))
+ continue;
+ }
+
if (strncmp(path, match, pathlen))
continue;
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) {
return 0;
}
+ if (!name) {
+ static char commit_name[60];
+ strcpy(commit_name, sha1_to_hex(commit));
+ name = commit_name;
+ }
+
offset = 46;
while (offset + 48 < size && !memcmp(buf + offset, "parent ", 7)) {
unsigned char parent[20];
usage(diff_tree_usage);
break;
case 1:
- diff_tree_commit(sha1[0], sha1_to_hex(sha1[0]));
+ diff_tree_commit(sha1[0], NULL);
break;
case 2:
diff_tree_sha1(sha1[0], sha1[1], "");