From: Junio C Hamano Date: Thu, 27 Jun 2013 21:29:59 +0000 (-0700) Subject: Merge branch 'rr/cherry-pick-fast-forward-reflog-message' X-Git-Tag: v1.8.4-rc0~112 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/644daa9428323ecdef08dfce589aa386bd2d97d4?ds=inline;hp=-c 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 --- 644daa9428323ecdef08dfce589aa386bd2d97d4 diff --combined sequencer.c index f7be7d8be6,423c1f583d..425207ad5f --- a/sequencer.c +++ b/sequencer.c @@@ -270,15 -270,20 +270,20 @@@ static int error_dirty_index(struct rep } static int fast_forward_to(const unsigned char *to, const unsigned char *from, - int unborn) + int unborn, struct replay_opts *opts) { struct ref_lock *ref_lock; + struct strbuf sb = STRBUF_INIT; + int ret; read_cache(); if (checkout_fast_forward(from, to, 1)) exit(1); /* the callee should have complained already */ ref_lock = lock_any_ref_for_update("HEAD", unborn ? null_sha1 : from, 0); - return write_ref_sha1(ref_lock, to, "cherry-pick"); + strbuf_addf(&sb, "%s: fast-forward", action_name(opts)); + ret = write_ref_sha1(ref_lock, to, sb.buf); + strbuf_release(&sb); + return ret; } static int do_recursive_merge(struct commit *base, struct commit *next, @@@ -474,7 -479,7 +479,7 @@@ static int do_pick_commit(struct commi struct commit_message msg = { NULL, NULL, NULL, NULL, NULL }; char *defmsg = NULL; struct strbuf msgbuf = STRBUF_INIT; - int res, unborn = 0; + int res, unborn = 0, allow; if (opts->no_commit) { /* @@@ -523,7 -528,7 +528,7 @@@ if (opts->allow_ff && ((parent && !hashcmp(parent->object.sha1, head)) || (!parent && unborn))) - return fast_forward_to(commit->object.sha1, head, unborn); + return fast_forward_to(commit->object.sha1, head, unborn, opts); if (parent && parse_commit(parent) < 0) /* TRANSLATORS: The first %s will be "revert" or @@@ -624,18 -629,14 +629,18 @@@ msg.subject); print_advice(res == 1, opts); rerere(opts->allow_rerere_auto); - } else { - int allow = allow_empty(opts, commit); - if (allow < 0) - return allow; - if (!opts->no_commit) - res = run_git_commit(defmsg, opts, allow); + goto leave; + } + + allow = allow_empty(opts, commit); + if (allow < 0) { + res = allow; + goto leave; } + if (!opts->no_commit) + res = run_git_commit(defmsg, opts, allow); +leave: free_message(&msg); free(defmsg);