1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 14:06:14 +02:00

rebase -i: only write fixup-message when it's needed

The file "$GIT_DIR/rebase-merge/fixup-message" is only used for fixup
commands, there's no point in writing it for squash commands as it is
immediately deleted.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Phillip Wood 2021-01-19 13:10:56 +05:30 committed by Junio C Hamano
parent 66e871b664
commit eab0df0e5b

View File

@ -1757,11 +1757,10 @@ static int update_squash_messages(struct repository *r,
return error(_("could not read HEAD's commit message"));
find_commit_subject(head_message, &body);
if (write_message(body, strlen(body),
rebase_path_fixup_msg(), 0)) {
if (command == TODO_FIXUP && write_message(body, strlen(body),
rebase_path_fixup_msg(), 0) < 0) {
unuse_commit_buffer(head_commit, head_message);
return error(_("cannot write '%s'"),
rebase_path_fixup_msg());
return error(_("cannot write '%s'"), rebase_path_fixup_msg());
}
strbuf_addf(&buf, "%c ", comment_line_char);