Skip to content

Commit 644daa9

Browse files
committed
Merge branch 'rr/cherry-pick-fast-forward-reflog-message'
The reflog message created when "git cherry-pick" fast-forwarded did not say anything but "cherry-pick", but it now says "cherry-pick: fast-forward". * rr/cherry-pick-fast-forward-reflog-message: sequencer: write useful reflog message for fast-forward
2 parents b29dc5c + eb4be1c commit 644daa9

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)