Merge branch 'jk/commit-C-pick-empty' into maint
"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
This commit is contained in:
commit
b659f81085
@ -650,8 +650,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
} else if (use_message) {
|
} else if (use_message) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
buffer = strstr(use_message_buffer, "\n\n");
|
buffer = strstr(use_message_buffer, "\n\n");
|
||||||
if (!use_editor && (!buffer || buffer[2] == '\0'))
|
if (buffer)
|
||||||
die(_("commit has empty message"));
|
|
||||||
strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
|
strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
|
||||||
hook_arg1 = "commit";
|
hook_arg1 = "commit";
|
||||||
hook_arg2 = use_message;
|
hook_arg2 = use_message;
|
||||||
|
@ -223,7 +223,8 @@ test_expect_success 'Commit without message is allowed with --allow-empty-messag
|
|||||||
git add foo &&
|
git add foo &&
|
||||||
>empty &&
|
>empty &&
|
||||||
git commit --allow-empty-message <empty &&
|
git commit --allow-empty-message <empty &&
|
||||||
commit_msg_is ""
|
commit_msg_is "" &&
|
||||||
|
git tag empty-message-commit
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'Commit without message is no-no without --allow-empty-message' '
|
test_expect_success 'Commit without message is no-no without --allow-empty-message' '
|
||||||
@ -240,6 +241,14 @@ test_expect_success 'Commit a message with --allow-empty-message' '
|
|||||||
commit_msg_is "hello there"
|
commit_msg_is "hello there"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'commit -C empty respects --allow-empty-message' '
|
||||||
|
echo more >>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 () {
|
commit_for_rebase_autosquash_setup () {
|
||||||
echo "first content line" >>foo &&
|
echo "first content line" >>foo &&
|
||||||
git add foo &&
|
git add foo &&
|
||||||
|
Loading…
Reference in New Issue
Block a user