Skip to content

Commit 7472721

Browse files
phillipwoodgitster
authored andcommitted
sequencer: move reflog message functions
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f93ff17 commit 7472721

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

sequencer.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,39 @@ static void refer_to_commit(struct replay_opts *opts,
22352235
}
22362236
}
22372237

2238+
static const char *sequencer_reflog_action(struct replay_opts *opts)
2239+
{
2240+
if (!opts->reflog_action) {
2241+
opts->reflog_action = getenv(GIT_REFLOG_ACTION);
2242+
opts->reflog_action =
2243+
xstrdup(opts->reflog_action ? opts->reflog_action
2244+
: action_name(opts));
2245+
}
2246+
2247+
return opts->reflog_action;
2248+
}
2249+
2250+
__attribute__((format (printf, 3, 4)))
2251+
static const char *reflog_message(struct replay_opts *opts,
2252+
const char *sub_action, const char *fmt, ...)
2253+
{
2254+
va_list ap;
2255+
static struct strbuf buf = STRBUF_INIT;
2256+
2257+
va_start(ap, fmt);
2258+
strbuf_reset(&buf);
2259+
strbuf_addstr(&buf, sequencer_reflog_action(opts));
2260+
if (sub_action)
2261+
strbuf_addf(&buf, " (%s)", sub_action);
2262+
if (fmt) {
2263+
strbuf_addstr(&buf, ": ");
2264+
strbuf_vaddf(&buf, fmt, ap);
2265+
}
2266+
va_end(ap);
2267+
2268+
return buf.buf;
2269+
}
2270+
22382271
static int do_pick_commit(struct repository *r,
22392272
struct todo_item *item,
22402273
struct replay_opts *opts,
@@ -3922,39 +3955,6 @@ static int do_label(struct repository *r, const char *name, int len)
39223955
return ret;
39233956
}
39243957

3925-
static const char *sequencer_reflog_action(struct replay_opts *opts)
3926-
{
3927-
if (!opts->reflog_action) {
3928-
opts->reflog_action = getenv(GIT_REFLOG_ACTION);
3929-
opts->reflog_action =
3930-
xstrdup(opts->reflog_action ? opts->reflog_action
3931-
: action_name(opts));
3932-
}
3933-
3934-
return opts->reflog_action;
3935-
}
3936-
3937-
__attribute__((format (printf, 3, 4)))
3938-
static const char *reflog_message(struct replay_opts *opts,
3939-
const char *sub_action, const char *fmt, ...)
3940-
{
3941-
va_list ap;
3942-
static struct strbuf buf = STRBUF_INIT;
3943-
3944-
va_start(ap, fmt);
3945-
strbuf_reset(&buf);
3946-
strbuf_addstr(&buf, sequencer_reflog_action(opts));
3947-
if (sub_action)
3948-
strbuf_addf(&buf, " (%s)", sub_action);
3949-
if (fmt) {
3950-
strbuf_addstr(&buf, ": ");
3951-
strbuf_vaddf(&buf, fmt, ap);
3952-
}
3953-
va_end(ap);
3954-
3955-
return buf.buf;
3956-
}
3957-
39583958
static struct commit *lookup_label(struct repository *r, const char *label,
39593959
int len, struct strbuf *buf)
39603960
{

0 commit comments

Comments
 (0)