summaryrefslogtreecommitdiff
path: root/diff-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-25 06:24:22 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-25 16:32:54 (GMT)
commit4cae1a967a99962e51777fcc950321902cce0adf (patch)
treef4a66b47e0671df3058c6487fe39d30f83150dd0 /diff-tree.c
parentf4d89f26cec4e2de3abde7fb2ab3aed8840d5435 (diff)
downloadgit-4cae1a967a99962e51777fcc950321902cce0adf.zip
git-4cae1a967a99962e51777fcc950321902cce0adf.tar.gz
git-4cae1a967a99962e51777fcc950321902cce0adf.tar.bz2
[PATCH] show changed tree objects with recursive git-diff-tree
This adds a "-t" flag to tell the raw diff output to include the tree objects in the output when doing a recursive diff. Since that's how the non-recursive output already handles trees and the flag thus doesn't make sense without "-r", I made "-t" imply "-r". Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-tree.c')
-rw-r--r--diff-tree.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/diff-tree.c b/diff-tree.c
index 266528a..7e16be4 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -6,6 +6,7 @@ static int show_root_diff = 0;
static int verbose_header = 0;
static int ignore_merges = 1;
static int recursive = 0;
+static int show_tree_entry_in_recursive = 0;
static int read_stdin = 0;
static int diff_output_format = DIFF_FORMAT_HUMAN;
static int detect_rename = 0;
@@ -123,6 +124,8 @@ static int compare_tree_entry(void *tree1, unsigned long size1, void *tree2, uns
if (recursive && S_ISDIR(mode1)) {
int retval;
char *newbase = malloc_base(base, path1, pathlen1);
+ if (show_tree_entry_in_recursive)
+ diff_change(mode1, mode2, sha1, sha2, base, path1);
retval = diff_tree_sha1(sha1, sha2, newbase);
free(newbase);
return retval;
@@ -463,7 +466,7 @@ static int diff_tree_stdin(char *line)
}
static char *diff_tree_usage =
-"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-m] [-s] [-v] <tree-ish> <tree-ish>";
+"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish>";
int main(int argc, const char **argv)
{
@@ -498,6 +501,10 @@ int main(int argc, const char **argv)
recursive = 1;
continue;
}
+ if (!strcmp(arg, "-t")) {
+ recursive = show_tree_entry_in_recursive = 1;
+ continue;
+ }
if (!strcmp(arg, "-R")) {
reverse_diff = 1;
continue;