Skip to content

Commit 2b473ce

Browse files
committed
Merge branch 'ks/commit-abort-on-empty-message-fix'
"git commit" when seeing an totally empty message said "you did not edit the message", which is clearly wrong. The message has been corrected. * ks/commit-abort-on-empty-message-fix: commit: check for empty message before the check for untouched template
2 parents 55c965f + bc17f35 commit 2b473ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

builtin/commit.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,17 +1739,17 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
17391739
if (verbose || /* Truncate the message just before the diff, if any. */
17401740
cleanup_mode == CLEANUP_SCISSORS)
17411741
strbuf_setlen(&sb, wt_status_locate_end(sb.buf, sb.len));
1742-
17431742
if (cleanup_mode != CLEANUP_NONE)
17441743
strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL);
1745-
if (template_untouched(&sb) && !allow_empty_message) {
1744+
1745+
if (message_is_empty(&sb) && !allow_empty_message) {
17461746
rollback_index_files();
1747-
fprintf(stderr, _("Aborting commit; you did not edit the message.\n"));
1747+
fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
17481748
exit(1);
17491749
}
1750-
if (message_is_empty(&sb) && !allow_empty_message) {
1750+
if (template_untouched(&sb) && !allow_empty_message) {
17511751
rollback_index_files();
1752-
fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
1752+
fprintf(stderr, _("Aborting commit; you did not edit the message.\n"));
17531753
exit(1);
17541754
}
17551755

0 commit comments

Comments
 (0)