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

Commit 9cbcc2a

Browse files
rctaygitster
authored andcommitted
demonstrate git-commit --dry-run exit code behaviour
In particular, show that --short and --porcelain, while implying --dry-run, do not return the same exit code as --dry-run. This is due to the wt_status.commitable flag being set only when a long status is requested. No fix is provided here; with [1], it should be trivial to fix though - just a matter of calling wt_status_mark_commitable(). [1] http://article.gmane.org/gmane.comp.version-control.git/242489 Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f95c9f commit 9cbcc2a

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)