From: Junio C Hamano Date: Fri, 6 Jun 2014 18:16:04 +0000 (-0700) Subject: Merge branch 'jk/commit-C-pick-empty' X-Git-Tag: v2.1.0-rc0~177 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e88155d1e1c3b55ed1f78425b0c2e5a09eea29dd?hp=561d952ed412889da454d852f027fd985d532c44 Merge branch 'jk/commit-C-pick-empty' "git commit --allow-empty-message -C $commit" did not work when the commit did not have any log message. * jk/commit-C-pick-empty: commit: do not complain of empty messages from -C --- diff --git a/builtin/commit.c b/builtin/commit.c index caec5c0e18..0320efd57d 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -676,9 +676,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, } else if (use_message) { char *buffer; buffer = strstr(use_message_buffer, "\n\n"); - if (!use_editor && (!buffer || buffer[2] == '\0')) - die(_("commit has empty message")); - strbuf_add(&sb, buffer + 2, strlen(buffer + 2)); + if (buffer) + strbuf_add(&sb, buffer + 2, strlen(buffer + 2)); hook_arg1 = "commit"; hook_arg2 = use_message; } else if (fixup_message) { diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index bdc1f29503..116885a260 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -223,7 +223,8 @@ test_expect_success 'Commit without message is allowed with --allow-empty-messag git add foo && >empty && git commit --allow-empty-message >foo && + git add foo && + test_must_fail git commit -C empty-message-commit && + git commit -C empty-message-commit --allow-empty-message && + commit_msg_is "" +' + commit_for_rebase_autosquash_setup () { echo "first content line" >>foo && git add foo &&