aboutsummaryrefslogtreecommitdiff
path: root/t/t7501-commit.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-01-23 14:54:57 -0500
committerJunio C Hamano <gitster@pobox.com>2014-01-23 13:11:07 -0800
commit088304bf73b9b4149e04d2246fe08a06eef6e795 (patch)
treea395ea4292eb2b2e84e72dbfecf6ace1a9b8c1ca /t/t7501-commit.sh
parentac930287ff16823531b541a8e6a7436279e612be (diff)
downloadgit-088304bf73b9b4149e04d2246fe08a06eef6e795.tar.gz
git-088304bf73b9b4149e04d2246fe08a06eef6e795.tar.xz
t7501: fix "empty commit" test with NO_PERL
t7501.9 tries to check that "git commit" will fail when the index is unchanged. It relies on previous tests not to have modified the index. When it was originally written, this was always the case. However, commit c65dc35 (t7501: test the right kind of breakage, 2012-03-30) changed earlier tests (4 and 5) to leave a modification in the index. We never noticed, however, because t7501.7, between the two, clears the index state as a side effect. However, that test depends on the PERL prerequisite, and so it does not always run. Therefore if NO_PERL is set, we do not run the intervening test, the index is left unclean, and t7501.9 fails. We could fix this by moving t7501.9 up in the script. However, this patch instead leaves it in place and adds a "git reset" before the commit. This makes the test more explicit about its preconditions, and will future-proof it against any other changes in the test state. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7501-commit.sh')
-rwxr-xr-xt/t7501-commit.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index f04798f87..94eec83b3 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -57,6 +57,7 @@ test_expect_success 'using invalid commit with -C' '
'
test_expect_success 'nothing to commit' '
+ git reset --hard &&
test_must_fail git commit -m initial
'