summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-02-16 06:57:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-24 15:08:34 (GMT)
commit287ab28bfae14431f3f57abeb92149c460044850 (patch)
tree0141e02aa7e1208c68484d960e96121b5ddcc946 /t
parent0d0ac3826a3bbb9247e39e12623bbcfdd722f24c (diff)
downloadgit-287ab28bfae14431f3f57abeb92149c460044850.zip
git-287ab28bfae14431f3f57abeb92149c460044850.tar.gz
git-287ab28bfae14431f3f57abeb92149c460044850.tar.bz2
diff: reuse diff setup for --no-index case
When "--no-index" is in effect (or implied by the arguments), git-diff jumps early to a special code path to perform that diff. This means we miss out on some settings like enabling --ext-diff and --textconv by default. Let's jump to the no-index path _after_ we've done more setup on rev.diffopt. Since some of the options don't affect us (e.g., items related to the index), let's re-order the setup into two blocks (see the in-code comments). Note that we also need to stop re-initializing the diffopt struct in diff_no_index(). This should not be necessary, as it will already have been initialized by cmd_diff() (and there are no other callers). That in turn lets us drop the "repository" argument from diff_no_index (which never made much sense, since the whole point is that you don't need a repository). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4053-diff-no-index.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 6e0dd6f..4331b31 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -137,4 +137,12 @@ test_expect_success 'diff --no-index from repo subdir with absolute paths' '
test_cmp expect actual
'
+test_expect_success 'diff --no-index allows external diff' '
+ test_expect_code 1 \
+ env GIT_EXTERNAL_DIFF="echo external ;:" \
+ git diff --no-index non/git/a non/git/b >actual &&
+ echo external >expect &&
+ test_cmp expect actual
+'
+
test_done