Teach --text option to diff
Add new item text to struct diff_options. If set then do not try to detect binary files. Signed-off-by: Stephan Feder <sf@b-i-t.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Stephan Feder committed
Jul 7, 2006 at 12:33 UTC
6d64ea965bc2894ef0aee16ac23a5e47f20eb824
2 files changed
+5
-1
diff.c
+4
-1
@@ -723,7 +723,7 @@ static void builtin_diff(const char *name_a,
723
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
724
die("unable to read files to diff");
725
726
- if (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2)) {
726
+ if (!o->text && (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2))) {
727
/* Quite common confusing case */
728
if (mf1.size == mf2.size &&
729
!memcmp(mf1.ptr, mf2.ptr, mf1.size))
@@ -1561,6 +1561,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
1561
options->output_format |= DIFF_FORMAT_PATCH;
1562
options->full_index = options->binary = 1;
1563
}
1564
+ else if (!strcmp(arg, "--text")) {
1565
+ options->text = 1;
1566
+ }
1567
else if (!strcmp(arg, "--name-only"))
1568
options->output_format |= DIFF_FORMAT_NAME;
1569
else if (!strcmp(arg, "--name-status"))
diff.h
+1
@@ -42,6 +42,7 @@ struct diff_options {
42
unsigned recursive:1,
43
tree_in_recursive:1,
44
binary:1,
45
+ text:1,
46
full_index:1,
47
silent_on_remove:1,
48
find_copies_harder:1,