Skip to content

Commit eb4be1c

Browse files
artagnongitster
authored andcommitted
sequencer: write useful reflog message for fast-forward
The following command $ git cherry-pick --ff b8bb3f writes the following uninformative message to the reflog cherry-pick Improve it to cherry-pick: fast-forward Avoid hard-coding "cherry-pick" in fast_forward_to(), so the sequencer is generic enough to support future actions. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb7dfaa commit eb4be1c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sequencer.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,20 @@ static int error_dirty_index(struct replay_opts *opts)
270270
}
271271

272272
static int fast_forward_to(const unsigned char *to, const unsigned char *from,
273-
int unborn)
273+
int unborn, struct replay_opts *opts)
274274
{
275275
struct ref_lock *ref_lock;
276+
struct strbuf sb = STRBUF_INIT;
277+
int ret;
276278

277279
read_cache();
278280
if (checkout_fast_forward(from, to, 1))
279281
exit(1); /* the callee should have complained already */
280282
ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from, 0);
281-
return write_ref_sha1(ref_lock, to, "cherry-pick");
283+
strbuf_addf(&sb, "%s: fast-forward", action_name(opts));
284+
ret = write_ref_sha1(ref_lock, to, sb.buf);
285+
strbuf_release(&sb);
286+
return ret;
282287
}
283288

284289
static int do_recursive_merge(struct commit *base, struct commit *next,
@@ -523,7 +528,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
523528
if (opts->allow_ff &&
524529
((parent && !hashcmp(parent->object.sha1, head)) ||
525530
(!parent && unborn)))
526-
return fast_forward_to(commit->object.sha1, head, unborn);
531+
return fast_forward_to(commit->object.sha1, head, unborn, opts);
527532

528533
if (parent && parse_commit(parent) < 0)
529534
/* TRANSLATORS: The first %s will be "revert" or

0 commit comments

Comments
 (0)