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 <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Feb 22, 2014 at 03:16 UTC
9cbcc2a7ca5b09ff57b52b7f6e422228f6cfd451
1 file changed
+36
t/t7501-commit.sh
+36
@@ -61,11 +61,47 @@ test_expect_success 'nothing to commit' '
61
test_must_fail git commit -m initial
62
'
63
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
+
80
test_expect_success 'setup: non-initial commit' '
81
echo bongo bongo bongo >file &&
82
git commit -m next -a
83
'
84
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
+
105
test_expect_success 'commit message from non-existing file' '
106
echo more bongo: bongo bongo bongo bongo >file &&
107
test_must_fail git commit -F gah -a