]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: move reflog message functions
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 9 May 2025 16:22:26 +0000 (16:22 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 May 2025 20:22:51 +0000 (13:22 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c

index 407ee4e90fea685a53504265ce528cb3b8443330..78db77c36ce91bb5d7817d5406932feb2077dca6 100644 (file)
@@ -2235,6 +2235,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,
@@ -3922,39 +3955,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)
 {