Skip to content

Commit

Permalink
Merge branch 'tc/commit-dry-run-exit-status-tests'
Browse files Browse the repository at this point in the history
* tc/commit-dry-run-exit-status-tests:
  demonstrate git-commit --dry-run exit code behaviour
  • Loading branch information
Junio C Hamano committed Mar 21, 2014
2 parents 5172cb3 + 9cbcc2a commit 4291cc1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions t/t7501-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,47 @@ test_expect_success 'nothing to commit' '
test_must_fail git commit -m initial
'

test_expect_success '--dry-run fails with nothing to commit' '
test_must_fail git commit -m initial --dry-run
'

test_expect_success '--short fails with nothing to commit' '
test_must_fail git commit -m initial --short
'

test_expect_success '--porcelain fails with nothing to commit' '
test_must_fail git commit -m initial --porcelain
'

test_expect_success '--long fails with nothing to commit' '
test_must_fail git commit -m initial --long
'

test_expect_success 'setup: non-initial commit' '
echo bongo bongo bongo >file &&
git commit -m next -a
'

test_expect_success '--dry-run with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --dry-run
'

test_expect_failure '--short with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --short
'

test_expect_failure '--porcelain with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --porcelain
'

test_expect_success '--long with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --long
'

test_expect_success 'commit message from non-existing file' '
echo more bongo: bongo bongo bongo bongo >file &&
test_must_fail git commit -F gah -a
Expand Down

0 comments on commit 4291cc1

Please sign in to comment.