"Nazri Ramliy" [off-list ref] writes:
git-diff does not honor the --no-ext-diff option in both cases when the external
diff program is set via diff.external and gitattributes.
Is this intentional?
Judging from 72909be (Add diff-option --ext-diff, 2007-06-30), I think
this was intended in the sense that --ext-diff and --no-ext-diff were
meant to be no-op for "diff" itself when they were introduced.
Having said that, I do not know if I agree with the original intention.
It looks more like an oversight that came from focusing only on what a new
behaviour for the "log" family should be, than a logical design decision
to exclude "diff" from this codepath.
Wouldn't this be a better patch?
builtin-diff.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git c/builtin-diff.c w/builtin-diff.c
index 7ceceeb..b90d8bc 100644
--- c/builtin-diff.c
+++ w/builtin-diff.c
@@ -290,6 +290,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
/* Otherwise, we are doing the usual "git" diff */
rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
+ /* Default to let external be used */
+ DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
+
if (nongit)
die("Not a git repository");
argc = setup_revisions(argc, argv, &rev, NULL);@@ -298,7 +301,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
if (diff_setup_done(&rev.diffopt) < 0)
die("diff_setup_done failed");
}
- DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
+
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
Junio C Hamano schrieb:
"Nazri Ramliy" [off-list ref] writes:
quoted
git-diff does not honor the --no-ext-diff option in both cases when the external
diff program is set via diff.external and gitattributes.
Is this intentional?
Judging from 72909be (Add diff-option --ext-diff, 2007-06-30), I think
this was intended in the sense that --ext-diff and --no-ext-diff were
meant to be no-op for "diff" itself when they were introduced.
Having said that, I do not know if I agree with the original intention.
It looks more like an oversight that came from focusing only on what a new
behaviour for the "log" family should be, than a logical design decision
to exclude "diff" from this codepath.
Wouldn't this be a better patch?
Yes. And feel free to squash in the following. :)
diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh
index dfe3fbc..ec787b4 100755
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
@@ -43,6 +43,13 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment should apply only to diff' '
'
+test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' '
+
+ GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff |
+ grep "^diff --git a/file b/file"
+
+'
+
test_expect_success 'diff attribute' '
git config diff.parrot.command echo &&
@@ -68,6 +75,13 @@ test_expect_success 'diff attribute should apply only to diff' '
'
+test_expect_success 'diff attribute and --no-ext-diff' '
+
+ git diff --no-ext-diff |
+ grep "^diff --git a/file b/file"
+
+'
+
test_expect_success 'diff attribute' '
git config --unset diff.parrot.command &&
@@ -94,6 +108,13 @@ test_expect_success 'diff attribute should apply only to diff' '
'
+test_expect_success 'diff attribute and --no-ext-diff' '
+
+ git diff --no-ext-diff |
+ grep "^diff --git a/file b/file"
+
+'
+
test_expect_success 'no diff with -diff' '
echo >.gitattributes "file -diff" &&
git diff | grep Binary
On Wed, Nov 26, 2008 at 3:59 PM, René Scharfe
[off-list ref] wrote:
Junio C Hamano schrieb:
quoted
Wouldn't this be a better patch?
Yes. And feel free to squash in the following. :)
Good! So the Eek! part is not really necessary.
Now I can trigger the external diff whenever I say so via GIT_EXTERNAL_DIFF.
Thanks.
Nazri.