diff options
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/sequencer.c b/sequencer.c index ab6f8a722d..351548f57d 100644 --- a/sequencer.c +++ b/sequencer.c @@ -270,15 +270,20 @@ static int error_dirty_index(struct replay_opts *opts) } 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, @@ -326,7 +331,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next, int i; strbuf_addstr(msgbuf, "\nConflicts:\n"); for (i = 0; i < active_nr;) { - struct cache_entry *ce = active_cache[i++]; + const struct cache_entry *ce = active_cache[i++]; if (ce_stage(ce)) { strbuf_addch(msgbuf, '\t'); strbuf_addstr(msgbuf, ce->name); @@ -366,8 +371,9 @@ static int is_index_unchanged(void) active_cache_tree = cache_tree(); if (!cache_tree_fully_valid(active_cache_tree)) - if (cache_tree_update(active_cache_tree, active_cache, - active_nr, 0)) + if (cache_tree_update(active_cache_tree, + (const struct cache_entry * const *)active_cache, + active_nr, 0)) return error(_("Unable to update cache tree\n")); return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.sha1); @@ -474,7 +480,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) 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 +529,7 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) 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,14 +630,18 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts) 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); |