From: "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>,
Jeff King <peff@peff.net>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH 1/2] sequencer: move reflog message functions
Date: Fri, 09 May 2025 16:22:26 +0000 [thread overview]
Message-ID: <fa5442cb805793adfe1f0b26ec79a75388317d2b.1746807747.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1919.git.1746807747.gitgitgadget@gmail.com>
From: Phillip Wood <phillip.wood@dunelm.org.uk>
In the next commit these functions will be called from pick_one_commit()
so move them above that function to avoid a forward declaration.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
sequencer.c | 66 ++++++++++++++++++++++++++---------------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 9ea678364d4f..bb4667190db1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2226,6 +2226,39 @@ static void refer_to_commit(struct replay_opts *opts,
}
}
+static const char *sequencer_reflog_action(struct replay_opts *opts)
+{
+ if (!opts->reflog_action) {
+ opts->reflog_action = getenv(GIT_REFLOG_ACTION);
+ opts->reflog_action =
+ xstrdup(opts->reflog_action ? opts->reflog_action
+ : action_name(opts));
+ }
+
+ return opts->reflog_action;
+}
+
+__attribute__((format (printf, 3, 4)))
+static const char *reflog_message(struct replay_opts *opts,
+ const char *sub_action, const char *fmt, ...)
+{
+ va_list ap;
+ static struct strbuf buf = STRBUF_INIT;
+
+ va_start(ap, fmt);
+ strbuf_reset(&buf);
+ strbuf_addstr(&buf, sequencer_reflog_action(opts));
+ if (sub_action)
+ strbuf_addf(&buf, " (%s)", sub_action);
+ if (fmt) {
+ strbuf_addstr(&buf, ": ");
+ strbuf_vaddf(&buf, fmt, ap);
+ }
+ va_end(ap);
+
+ return buf.buf;
+}
+
static int do_pick_commit(struct repository *r,
struct todo_item *item,
struct replay_opts *opts,
@@ -3919,39 +3952,6 @@ static int do_label(struct repository *r, const char *name, int len)
return ret;
}
-static const char *sequencer_reflog_action(struct replay_opts *opts)
-{
- if (!opts->reflog_action) {
- opts->reflog_action = getenv(GIT_REFLOG_ACTION);
- opts->reflog_action =
- xstrdup(opts->reflog_action ? opts->reflog_action
- : action_name(opts));
- }
-
- return opts->reflog_action;
-}
-
-__attribute__((format (printf, 3, 4)))
-static const char *reflog_message(struct replay_opts *opts,
- const char *sub_action, const char *fmt, ...)
-{
- va_list ap;
- static struct strbuf buf = STRBUF_INIT;
-
- va_start(ap, fmt);
- strbuf_reset(&buf);
- strbuf_addstr(&buf, sequencer_reflog_action(opts));
- if (sub_action)
- strbuf_addf(&buf, " (%s)", sub_action);
- if (fmt) {
- strbuf_addstr(&buf, ": ");
- strbuf_vaddf(&buf, fmt, ap);
- }
- va_end(ap);
-
- return buf.buf;
-}
-
static struct commit *lookup_label(struct repository *r, const char *label,
int len, struct strbuf *buf)
{
--
gitgitgadget
next prev parent reply other threads:[~2025-05-09 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 16:22 [PATCH 0/2] Sequencer: avoid use-after-free when creating merges Phillip Wood via GitGitGadget
2025-05-09 16:22 ` Phillip Wood via GitGitGadget [this message]
2025-05-09 16:22 ` [PATCH 2/2] sequencer: rework reflog message handling Phillip Wood via GitGitGadget
2025-05-09 20:37 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa5442cb805793adfe1f0b26ec79a75388317d2b.1746807747.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.