summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorStephan Feder <sf@b-i-t.de>2006-07-07 10:33:57 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-07 19:28:04 (GMT)
commit6d64ea965bc2894ef0aee16ac23a5e47f20eb824 (patch)
tree9c024a9c39059d167ce570fc8b49c26d2ef6993a /diff.c
parent6bdca8905764affcab0c92a60a6a319080d76652 (diff)
downloadgit-6d64ea965bc2894ef0aee16ac23a5e47f20eb824.zip
git-6d64ea965bc2894ef0aee16ac23a5e47f20eb824.tar.gz
git-6d64ea965bc2894ef0aee16ac23a5e47f20eb824.tar.bz2
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>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index f0450a8..1f0219d 100644
--- a/diff.c
+++ b/diff.c
@@ -723,7 +723,7 @@ static void builtin_diff(const char *name_a,
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
- if (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2)) {
+ if (!o->text && (mmfile_is_binary(&mf1) || mmfile_is_binary(&mf2))) {
/* Quite common confusing case */
if (mf1.size == mf2.size &&
!memcmp(mf1.ptr, mf2.ptr, mf1.size))
@@ -1561,6 +1561,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->output_format |= DIFF_FORMAT_PATCH;
options->full_index = options->binary = 1;
}
+ else if (!strcmp(arg, "--text")) {
+ options->text = 1;
+ }
else if (!strcmp(arg, "--name-only"))
options->output_format |= DIFF_FORMAT_NAME;
else if (!strcmp(arg, "--name-status"))