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:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-07-10 11:47:28 +0300
committerJunio C Hamano <gitster@pobox.com>2021-07-12 22:09:53 +0300
commitd4ac305073411bd70ae94e79c8fe8130a7d378aa (patch)
tree94c3fa966fe2d2fc4172f0f4cb5f52cb44074fbe /sequencer.c
parent103e02c7001f5c4989d56360c8cfc615f29fc9a7 (diff)
sequencer.c: move static function to avoid forward decl
Move the reflog_message() function added in 96e832a5fd6 (sequencer (rebase -i): refactor setting the reflog message, 2017-01-02), it gained another user in 9055e401dd6 (sequencer: introduce new commands to reset the revision, 2018-04-25). Let's move it around and remove the forward declaration added in the latter commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/sequencer.c b/sequencer.c
index 0bec01cf38..c316d8374a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3599,7 +3599,25 @@ static int do_label(struct repository *r, const char *name, int len)
}
static const char *reflog_message(struct replay_opts *opts,
- const char *sub_action, const char *fmt, ...);
+ const char *sub_action, const char *fmt, ...)
+{
+ va_list ap;
+ static struct strbuf buf = STRBUF_INIT;
+ char *reflog_action = getenv(GIT_REFLOG_ACTION);
+
+ va_start(ap, fmt);
+ strbuf_reset(&buf);
+ strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(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_reset(struct repository *r,
const char *name, int len,
@@ -4178,27 +4196,6 @@ int apply_autostash_oid(const char *stash_oid)
return apply_save_autostash_oid(stash_oid, 1);
}
-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;
- char *reflog_action = getenv(GIT_REFLOG_ACTION);
-
- va_start(ap, fmt);
- strbuf_reset(&buf);
- strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(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 run_git_checkout(struct repository *r, struct replay_opts *opts,
const char *commit, const char *action)
{