Skip to content

Commit 088304b

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac93028 commit 088304b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/t7501-commit.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ test_expect_success 'using invalid commit with -C' '
5757
'
5858

5959
test_expect_success 'nothing to commit' '
60+
git reset --hard &&
6061
test_must_fail git commit -m initial
6162
'
6263

0 commit comments

Comments
 (0)