From: Junio C Hamano Date: Wed, 23 Aug 2017 21:33:44 +0000 (-0700) Subject: Merge branch 'ks/commit-abort-on-empty-message-fix' into maint X-Git-Tag: v2.14.2~58 X-Git-Url: https://www.git.lorimer.id.au/gitweb.git/diff_plain/01ced48994640b7d6fd72289544e766dc9009de7?hp=0cb526e031bd28f33750ed7beef1d7556ef387ea Merge branch 'ks/commit-abort-on-empty-message-fix' into maint "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 --- diff --git a/builtin/commit.c b/builtin/commit.c index 8e93802511..1a0da71a43 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1739,17 +1739,17 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (verbose || /* Truncate the message just before the diff, if any. */ cleanup_mode == CLEANUP_SCISSORS) strbuf_setlen(&sb, wt_status_locate_end(sb.buf, sb.len)); - if (cleanup_mode != CLEANUP_NONE) strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL); - if (template_untouched(&sb) && !allow_empty_message) { + + if (message_is_empty(&sb) && !allow_empty_message) { rollback_index_files(); - fprintf(stderr, _("Aborting commit; you did not edit the message.\n")); + fprintf(stderr, _("Aborting commit due to empty commit message.\n")); exit(1); } - if (message_is_empty(&sb) && !allow_empty_message) { + if (template_untouched(&sb) && !allow_empty_message) { rollback_index_files(); - fprintf(stderr, _("Aborting commit due to empty commit message.\n")); + fprintf(stderr, _("Aborting commit; you did not edit the message.\n")); exit(1); }