Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2021-01-19 10:40:57 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-21 04:50:11 +0300
commit498bb5b82e78ddf880ab8516d4e6ac4fc5f9b215 (patch)
tree52fed48a50654f1823ce856fd741c46adfd40493 /sequencer.c
parenteab0df0e5b96ea8ca60f030dd8c5f6e5926988de (diff)
sequencer: factor out code to append squash message
This code is going to grow over the next two commits so move it to its own function. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> 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.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sequencer.c b/sequencer.c
index a59e0c84af..08cce40834 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1718,6 +1718,17 @@ static int is_pick_or_similar(enum todo_command command)
}
}
+static void append_squash_message(struct strbuf *buf, const char *body,
+ struct replay_opts *opts)
+{
+ unlink(rebase_path_fixup_msg());
+ strbuf_addf(buf, "\n%c ", comment_line_char);
+ strbuf_addf(buf, _("This is the commit message #%d:"),
+ ++opts->current_fixup_count + 1);
+ strbuf_addstr(buf, "\n\n");
+ strbuf_addstr(buf, body);
+}
+
static int update_squash_messages(struct repository *r,
enum todo_command command,
struct commit *commit,
@@ -1779,12 +1790,7 @@ static int update_squash_messages(struct repository *r,
find_commit_subject(message, &body);
if (command == TODO_SQUASH) {
- unlink(rebase_path_fixup_msg());
- strbuf_addf(&buf, "\n%c ", comment_line_char);
- strbuf_addf(&buf, _("This is the commit message #%d:"),
- ++opts->current_fixup_count + 1);
- strbuf_addstr(&buf, "\n\n");
- strbuf_addstr(&buf, body);
+ append_squash_message(&buf, body, opts);
} else if (command == TODO_FIXUP) {
strbuf_addf(&buf, "\n%c ", comment_line_char);
strbuf_addf(&buf, _("The commit message #%d will be skipped:"),