aboutsummaryrefslogtreecommitdiff
path: root/diff-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-21 19:42:18 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-21 22:49:19 -0700
commit81e50eabf06dd68e8e62a9b697eaf60904c58b22 (patch)
treef7cf8566f2a72a669b6e4bbaca0cf6ca5a781dd3 /diff-tree.c
parent38c6f78059c3060db6f94b24f4a90063a91090d2 (diff)
downloadgit-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.gz
git-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.xz
[PATCH] The diff-raw format updates.
Update the diff-raw format as Linus and I discussed, except that it does not use sequence of underscore '_' letters to express nonexistence. All '0' mode is used for that purpose instead. The new diff-raw format can express rename/copy, and the earlier restriction that -M and -C _must_ be used with the patch format output is no longer necessary. The patch makes -M and -C flags independent of -p flag, so you need to say git-whatchanged -M -p to get the diff/patch format. Updated are both documentations and tests. 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.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/diff-tree.c b/diff-tree.c
index e8bad7221..3428a6ee9 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -8,8 +8,7 @@ static int verbose_header = 0;
static int ignore_merges = 1;
static int recursive = 0;
static int read_stdin = 0;
-static int line_termination = '\n';
-static int generate_patch = 0;
+static int diff_output_format = DIFF_FORMAT_HUMAN;
static int detect_rename = 0;
static int reverse_diff = 0;
static int diff_score_opt = 0;
@@ -269,7 +268,7 @@ static int diff_tree_sha1(const unsigned char *old, const unsigned char *new, co
static void call_diff_setup(void)
{
- diff_setup(reverse_diff, (generate_patch ? -1 : line_termination));
+ diff_setup(reverse_diff, diff_output_format);
}
static void call_diff_flush(void)
@@ -501,7 +500,8 @@ int main(int argc, char **argv)
continue;
}
if (!strcmp(arg, "-p")) {
- recursive = generate_patch = 1;
+ diff_output_format = DIFF_FORMAT_PATCH;
+ recursive = 1;
continue;
}
if (!strncmp(arg, "-S", 2)) {
@@ -509,18 +509,17 @@ int main(int argc, char **argv)
continue;
}
if (!strncmp(arg, "-M", 2)) {
- detect_rename = recursive = generate_patch = 1;
+ detect_rename = 1;
diff_score_opt = diff_scoreopt_parse(arg);
continue;
}
if (!strncmp(arg, "-C", 2)) {
detect_rename = 2;
- recursive = generate_patch = 1;
diff_score_opt = diff_scoreopt_parse(arg);
continue;
}
if (!strcmp(arg, "-z")) {
- line_termination = '\0';
+ diff_output_format = DIFF_FORMAT_MACHINE;
continue;
}
if (!strcmp(arg, "-m")) {