summaryrefslogtreecommitdiff
path: root/diff-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-22 02:42:18 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-22 05:49:19 (GMT)
commit81e50eabf06dd68e8e62a9b697eaf60904c58b22 (patch)
treef7cf8566f2a72a669b6e4bbaca0cf6ca5a781dd3 /diff-files.c
parent38c6f78059c3060db6f94b24f4a90063a91090d2 (diff)
downloadgit-81e50eabf06dd68e8e62a9b697eaf60904c58b22.zip
git-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.gz
git-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.bz2
[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-files.c')
-rw-r--r--diff-files.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/diff-files.c b/diff-files.c
index a47bd43..884d452 100644
--- a/diff-files.c
+++ b/diff-files.c
@@ -9,8 +9,7 @@
static const char *diff_files_usage =
"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [-S<string>] [paths...]";
-static int generate_patch = 0;
-static int line_termination = '\n';
+static int diff_output_format = DIFF_FORMAT_HUMAN;
static int detect_rename = 0;
static int reverse_diff = 0;
static int diff_score_opt = 0;
@@ -57,7 +56,7 @@ int main(int argc, char **argv)
while (1 < argc && argv[1][0] == '-') {
if (!strcmp(argv[1], "-p"))
- generate_patch = 1;
+ diff_output_format = DIFF_FORMAT_PATCH;
else if (!strcmp(argv[1], "-q"))
silent = 1;
else if (!strcmp(argv[1], "-r"))
@@ -65,19 +64,18 @@ int main(int argc, char **argv)
else if (!strcmp(argv[1], "-s"))
; /* no-op */
else if (!strcmp(argv[1], "-z"))
- line_termination = 0;
+ diff_output_format = DIFF_FORMAT_MACHINE;
else if (!strcmp(argv[1], "-R"))
reverse_diff = 1;
else if (!strcmp(argv[1], "-S"))
pickaxe = argv[1] + 2;
else if (!strncmp(argv[1], "-M", 2)) {
diff_score_opt = diff_scoreopt_parse(argv[1]);
- detect_rename = generate_patch = 1;
+ detect_rename = 1;
}
else if (!strncmp(argv[1], "-C", 2)) {
diff_score_opt = diff_scoreopt_parse(argv[1]);
detect_rename = 2;
- generate_patch = 1;
}
else
usage(diff_files_usage);
@@ -92,7 +90,7 @@ int main(int argc, char **argv)
exit(1);
}
- diff_setup(reverse_diff, (generate_patch ? -1 : line_termination));
+ diff_setup(reverse_diff, diff_output_format);
for (i = 0; i < entries; i++) {
struct stat st;