Skip to content

Commit

Permalink
t7501: test the right kind of breakage
Browse files Browse the repository at this point in the history
These tests try to run "git commit" with various "forbidden" combinations
of options and expect the command to fail, but they do so without having
any change added to the index.  We wouldn't be able to catch breakages
that would allow these combinations by mistake with them because the
command will fail with "nothing to commit" anyway.

Make sure we have something added to the index before running the command.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Mar 30, 2012
1 parent 828ea97 commit c65dc35
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/t7501-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ test_expect_success 'setup: initial commit' '
'

test_expect_success '-m and -F do not mix' '
git checkout HEAD file && echo >>file && git add file &&
test_must_fail git commit -m foo -m bar -F file
'

test_expect_success '-m and -C do not mix' '
git checkout HEAD file && echo >>file && git add file &&
test_must_fail git commit -C HEAD -m illegal
'

Expand Down

0 comments on commit c65dc35

Please sign in to comment.