aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2013-12-16 21:19:23 +0100
committerJunio C Hamano <gitster@pobox.com>2013-12-16 13:12:33 -0800
commit8a19dfa1aa5bbbc6e3ea8553e418ad4f78448cb3 (patch)
tree6fc54694bf84bd40d46081c72f42672507e0677a
parent6df5762db354ca55a0cf77451d06b332b7de0b82 (diff)
downloadgit-8a19dfa1aa5bbbc6e3ea8553e418ad4f78448cb3.tar.gz
git-8a19dfa1aa5bbbc6e3ea8553e418ad4f78448cb3.tar.xz
diff: add test for --no-index executed outside repo
470faf9 diff: move no-index detection to builtin/diff.c breaks the error message for "git diff --no-index", when the command is executed outside of a git repository and the wrong number of arguments are given. 6df5762 diff: don't read index when --no-index is given fixes the problem. Add a test to guard against similar breakages in the future. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t4053-diff-no-index.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 077c775e7..2ab3c4873 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -44,4 +44,15 @@ test_expect_success 'git diff outside repo with broken index' '
)
'
+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