Advertise the ability to abort a commit
This treats aborting a commit more like a feature. Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Anders Melchiorsen committed
Jul 29, 2008 at 22:12 UTC
bd2574ca69331d33429f8806ce189b2941e490e7
2 files changed
+5
-3
builtin-commit.c
+1
@@ -555,6 +555,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
555
fprintf(fp,
556
"\n"
557
"# Please enter the commit message for your changes.\n"
558
+ "# To abort the commit, use an empty commit message.\n"
559
"# (Comment lines starting with '#' will ");
560
if (cleanup_mode == CLEANUP_ALL)
561
fprintf(fp, "not be included)\n");
t/t7502-commit.sh
+4
-3
@@ -142,6 +142,7 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
142
echo "sample
143
144
# Please enter the commit message for your changes.
145
+# To abort the commit, use an empty commit message.
146
# (Comment lines starting with '#' will not be included)" >expect
147
148
test_expect_success 'cleanup commit messages (strip,-F,-e)' '
@@ -149,7 +150,7 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' '
150
echo >>negative &&
151
{ echo;echo sample;echo; } >text &&
152
git commit -e -F text -a &&
152
- head -n 4 .git/COMMIT_EDITMSG >actual &&
153
+ head -n 5 .git/COMMIT_EDITMSG >actual &&
154
test_cmp expect actual
155
156
'
@@ -162,7 +163,7 @@ test_expect_success 'author different from committer' '
163
164
echo >>negative &&
165
git commit -e -m "sample"
165
- head -n 7 .git/COMMIT_EDITMSG >actual &&
166
+ head -n 8 .git/COMMIT_EDITMSG >actual &&
167
test_cmp expect actual
168
'
169
@@ -181,7 +182,7 @@ test_expect_success 'committer is automatic' '
182
# must fail because there is no change
183
test_must_fail git commit -e -m "sample"
184
) &&
184
- head -n 8 .git/COMMIT_EDITMSG | \
185
+ head -n 9 .git/COMMIT_EDITMSG | \
186
sed "s/^# Committer: .*/# Committer:/" >actual &&
187
test_cmp expect actual
188
'