Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 4291cc1

Browse files
committed
Merge branch 'tc/commit-dry-run-exit-status-tests'
* tc/commit-dry-run-exit-status-tests: demonstrate git-commit --dry-run exit code behaviour
2 parents 5172cb3 + 9cbcc2a commit 4291cc1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t7501-commit.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,47 @@ test_expect_success 'nothing to commit' '
6161
test_must_fail git commit -m initial
6262
'
6363

64+
test_expect_success '--dry-run fails with nothing to commit' '
65+
test_must_fail git commit -m initial --dry-run
66+
'
67+
68+
test_expect_success '--short fails with nothing to commit' '
69+
test_must_fail git commit -m initial --short
70+
'
71+
72+
test_expect_success '--porcelain fails with nothing to commit' '
73+
test_must_fail git commit -m initial --porcelain
74+
'
75+
76+
test_expect_success '--long fails with nothing to commit' '
77+
test_must_fail git commit -m initial --long
78+
'
79+
6480
test_expect_success 'setup: non-initial commit' '
6581
echo bongo bongo bongo >file &&
6682
git commit -m next -a
6783
'
6884

85+
test_expect_success '--dry-run with stuff to commit returns ok' '
86+
echo bongo bongo bongo >>file &&
87+
git commit -m next -a --dry-run
88+
'
89+
90+
test_expect_failure '--short with stuff to commit returns ok' '
91+
echo bongo bongo bongo >>file &&
92+
git commit -m next -a --short
93+
'
94+
95+
test_expect_failure '--porcelain with stuff to commit returns ok' '
96+
echo bongo bongo bongo >>file &&
97+
git commit -m next -a --porcelain
98+
'
99+
100+
test_expect_success '--long with stuff to commit returns ok' '
101+
echo bongo bongo bongo >>file &&
102+
git commit -m next -a --long
103+
'
104+
69105
test_expect_success 'commit message from non-existing file' '
70106
echo more bongo: bongo bongo bongo bongo >file &&
71107
test_must_fail git commit -F gah -a

0 commit comments

Comments
 (0)