diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-12-27 14:58:17 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-27 14:58:17 -0800 |
commit | 73b063130befa7475316a142343de87da61f31e3 (patch) | |
tree | 3079b4e1f628ff89bcc0a4e5dbb42985e2c7b3a0 /t/t4053-diff-no-index.sh | |
parent | Merge branch 'zk/difftool-counts' (diff) | |
parent | diff: avoid some nesting (diff) | |
download | tgif-73b063130befa7475316a142343de87da61f31e3.tar.xz |
Merge branch 'tg/diff-no-index-refactor'
"git diff ../else/where/A ../else/where/B" when ../else/where is
clearly outside the repository, and "git diff --no-index A B", do
not have to look at the index at all, but we used to read the index
unconditionally.
* tg/diff-no-index-refactor:
diff: avoid some nesting
diff: add test for --no-index executed outside repo
diff: don't read index when --no-index is given
diff: move no-index detection to builtin/diff.c
Diffstat (limited to 't/t4053-diff-no-index.sh')
-rwxr-xr-x | t/t4053-diff-no-index.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh index 979e98398b..2ab3c48734 100755 --- a/t/t4053-diff-no-index.sh +++ b/t/t4053-diff-no-index.sh @@ -29,4 +29,30 @@ test_expect_success 'git diff --no-index relative path outside repo' ' ) ' +test_expect_success 'git diff --no-index with broken index' ' + ( + cd repo && + echo broken >.git/index && + git diff --no-index a ../non/git/a + ) +' + +test_expect_success 'git diff outside repo with broken index' ' + ( + cd repo && + git diff ../non/git/a ../non/git/b + ) +' + +test_expect_success 'git diff --no-index executed outside repo gives correct error message' ' + ( + GIT_CEILING_DIRECTORIES=$TRASH_DIRECTORY/non && + export GIT_CEILING_DIRECTORIES && + cd non/git && + test_must_fail git diff --no-index a 2>actual.err && + echo "usage: git diff --no-index <path> <path>" >expect.err && + test_cmp expect.err actual.err + ) +' + test_done |