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
This commit is contained in:
commit
2b473ce78c
@ -1739,19 +1739,19 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||||||
if (verbose || /* Truncate the message just before the diff, if any. */
|
if (verbose || /* Truncate the message just before the diff, if any. */
|
||||||
cleanup_mode == CLEANUP_SCISSORS)
|
cleanup_mode == CLEANUP_SCISSORS)
|
||||||
strbuf_setlen(&sb, wt_status_locate_end(sb.buf, sb.len));
|
strbuf_setlen(&sb, wt_status_locate_end(sb.buf, sb.len));
|
||||||
|
|
||||||
if (cleanup_mode != CLEANUP_NONE)
|
if (cleanup_mode != CLEANUP_NONE)
|
||||||
strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL);
|
strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL);
|
||||||
if (template_untouched(&sb) && !allow_empty_message) {
|
|
||||||
rollback_index_files();
|
|
||||||
fprintf(stderr, _("Aborting commit; you did not edit the message.\n"));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (message_is_empty(&sb) && !allow_empty_message) {
|
if (message_is_empty(&sb) && !allow_empty_message) {
|
||||||
rollback_index_files();
|
rollback_index_files();
|
||||||
fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
|
fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
if (template_untouched(&sb) && !allow_empty_message) {
|
||||||
|
rollback_index_files();
|
||||||
|
fprintf(stderr, _("Aborting commit; you did not edit the message.\n"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (amend) {
|
if (amend) {
|
||||||
const char *exclude_gpgsig[2] = { "gpgsig", NULL };
|
const char *exclude_gpgsig[2] = { "gpgsig", NULL };
|
||||||
|
Loading…
Reference in New Issue
Block a user