summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4d89f2)
raw | patch | inline | side by side (parent: f4d89f2)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 25 May 2005 06:24:22 +0000 (23:24 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Wed, 25 May 2005 16:32:54 +0000 (09:32 -0700) |
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>
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>
Documentation/git-diff-tree.txt | patch | blob | history | |
diff-tree.c | patch | blob | history |
index ea680ccbfadb701d650e44ec58f2a72bc97fec44..e2a22e0869c5db73a29dd740fe089b43e104abbc 100644 (file)
SYNOPSIS
--------
-'git-diff-tree' [-p] [-r] [-z] [--stdin] [-M] [-R] [-C] [-S<string>] [-m] [-s] [-v] <tree-ish> <tree-ish> [<pattern>]\*
+'git-diff-tree' [-p] [-r] [-z] [--stdin] [-M] [-R] [-C] [-S<string>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish> [<pattern>]\*
DESCRIPTION
-----------
-r::
recurse
+-t::
+ show tree entry itself as well as subtrees. Implies -r.
+
-z::
\0 line termination on output
diff --git a/diff-tree.c b/diff-tree.c
index 266528a143af6dfb3ae2e05de6c030872304ff9f..7e16be42614a32a86897a4fab322757379ad3add 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
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;
}
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)
{
recursive = 1;
continue;
}
+ if (!strcmp(arg, "-t")) {
+ recursive = show_tree_entry_in_recursive = 1;
+ continue;
+ }
if (!strcmp(arg, "-R")) {
reverse_diff = 1;
continue;