summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2021-01-19 07:40:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-21 01:50:11 (GMT)
commiteab0df0e5b96ea8ca60f030dd8c5f6e5926988de (patch)
tree4ff99c4702c8030bb6c8051de117f47f9192c5ba /sequencer.c
parent66e871b6647ffea61a77a0f82c7ef3415f1ee79c (diff)
downloadgit-eab0df0e5b96ea8ca60f030dd8c5f6e5926988de.zip
git-eab0df0e5b96ea8ca60f030dd8c5f6e5926988de.tar.gz
git-eab0df0e5b96ea8ca60f030dd8c5f6e5926988de.tar.bz2
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>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sequencer.c b/sequencer.c
index 8909a46..a59e0c8 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -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);