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 <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Jun 19, 2013 at 13:07 UTC
eb4be1cbe2e50c9bfaa09839564723de257869fc
1 file changed
+8
-3
sequencer.c
+8
-3
@@ -270,15 +270,20 @@ static int error_dirty_index(struct replay_opts *opts)
270
}
271
272
static int fast_forward_to(const unsigned char *to, const unsigned char *from,
273
- int unborn)
273
+ int unborn, struct replay_opts *opts)
274
{
275
struct ref_lock *ref_lock;
276
+ struct strbuf sb = STRBUF_INIT;
277
+ int ret;
278
279
read_cache();
280
if (checkout_fast_forward(from, to, 1))
281
exit(1); /* the callee should have complained already */
282
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;
287
}
288
289
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)
528
if (opts->allow_ff &&
529
((parent && !hashcmp(parent->object.sha1, head)) ||
530
(!parent && unborn)))
526
- return fast_forward_to(commit->object.sha1, head, unborn);
531
+ return fast_forward_to(commit->object.sha1, head, unborn, opts);
532
533
if (parent && parse_commit(parent) < 0)
534
/* TRANSLATORS: The first %s will be "revert" or