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>
Phillip Wood committed
Jan 19, 2021 at 13:10 UTC
eab0df0e5b96ea8ca60f030dd8c5f6e5926988de
1 file changed
+3
-4
sequencer.c
+3
-4
@@ -1757,11 +1757,10 @@ static int update_squash_messages(struct repository *r,
1757
return error(_("could not read HEAD's commit message"));
1758
1759
find_commit_subject(head_message, &body);
1760
- if (write_message(body, strlen(body),
1761
- rebase_path_fixup_msg(), 0)) {
1760
+ if (command == TODO_FIXUP && write_message(body, strlen(body),
1761
+ rebase_path_fixup_msg(), 0) < 0) {
1762
unuse_commit_buffer(head_commit, head_message);
1763
- return error(_("cannot write '%s'"),
1764
- rebase_path_fixup_msg());
1763
+ return error(_("cannot write '%s'"), rebase_path_fixup_msg());
1764
}
1765
1766
strbuf_addf(&buf, "%c ", comment_line_char);