Skip to content

Commit eab0df0

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Signed-off-by: Charvi Mendiratta <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 66e871b commit eab0df0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sequencer.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,11 +1757,10 @@ static int update_squash_messages(struct repository *r,
17571757
return error(_("could not read HEAD's commit message"));
17581758

17591759
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) {
17621762
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());
17651764
}
17661765

17671766
strbuf_addf(&buf, "%c ", comment_line_char);

0 commit comments

Comments
 (0)