Skip to content

Commit d4ac305

Browse files
avargitster
authored andcommitted
sequencer.c: move static function to avoid forward decl
Move the reflog_message() function added in 96e832a (sequencer (rebase -i): refactor setting the reflog message, 2017-01-02), it gained another user in 9055e40 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 103e02c commit d4ac305

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

sequencer.c

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,7 +3599,25 @@ static int do_label(struct repository *r, const char *name, int len)
35993599
}
36003600

36013601
static const char *reflog_message(struct replay_opts *opts,
3602-
const char *sub_action, const char *fmt, ...);
3602+
const char *sub_action, const char *fmt, ...)
3603+
{
3604+
va_list ap;
3605+
static struct strbuf buf = STRBUF_INIT;
3606+
char *reflog_action = getenv(GIT_REFLOG_ACTION);
3607+
3608+
va_start(ap, fmt);
3609+
strbuf_reset(&buf);
3610+
strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(opts));
3611+
if (sub_action)
3612+
strbuf_addf(&buf, " (%s)", sub_action);
3613+
if (fmt) {
3614+
strbuf_addstr(&buf, ": ");
3615+
strbuf_vaddf(&buf, fmt, ap);
3616+
}
3617+
va_end(ap);
3618+
3619+
return buf.buf;
3620+
}
36033621

36043622
static int do_reset(struct repository *r,
36053623
const char *name, int len,
@@ -4178,27 +4196,6 @@ int apply_autostash_oid(const char *stash_oid)
41784196
return apply_save_autostash_oid(stash_oid, 1);
41794197
}
41804198

4181-
static const char *reflog_message(struct replay_opts *opts,
4182-
const char *sub_action, const char *fmt, ...)
4183-
{
4184-
va_list ap;
4185-
static struct strbuf buf = STRBUF_INIT;
4186-
char *reflog_action = getenv(GIT_REFLOG_ACTION);
4187-
4188-
va_start(ap, fmt);
4189-
strbuf_reset(&buf);
4190-
strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(opts));
4191-
if (sub_action)
4192-
strbuf_addf(&buf, " (%s)", sub_action);
4193-
if (fmt) {
4194-
strbuf_addstr(&buf, ": ");
4195-
strbuf_vaddf(&buf, fmt, ap);
4196-
}
4197-
va_end(ap);
4198-
4199-
return buf.buf;
4200-
}
4201-
42024199
static int run_git_checkout(struct repository *r, struct replay_opts *opts,
42034200
const char *commit, const char *action)
42044201
{

0 commit comments

Comments
 (0)