Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-07-18 22:20:29 +0300
committerJunio C Hamano <gitster@pobox.com>2018-07-18 22:20:29 +0300
commitd349e188abb88879f4c2cae9f089509b25606928 (patch)
tree461e219f92cc27c2474b881d13c769bc773aa89d /sequencer.c
parent6dcd36473a20e90d02463de5fe33eb94c4c33fa6 (diff)
parenta9279c678588a12485a8afa424036bdb5ad0534d (diff)
Merge branch 'pw/rebase-i-keep-reword-after-conflict'
Bugfix for "rebase -i" corner case regression. * pw/rebase-i-keep-reword-after-conflict: sequencer: do not squash 'reword' commits when we hit conflicts
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index 0a291c91fe..39363a950f 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3219,10 +3219,27 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
intend_to_amend();
return error_failed_squash(item->commit, opts,
item->arg_len, item->arg);
- } else if (res && is_rebase_i(opts) && item->commit)
+ } else if (res && is_rebase_i(opts) && item->commit) {
+ int to_amend = 0;
+ struct object_id oid;
+
+ /*
+ * If we are rewording and have either
+ * fast-forwarded already, or are about to
+ * create a new root commit, we want to amend,
+ * otherwise we do not.
+ */
+ if (item->command == TODO_REWORD &&
+ !get_oid("HEAD", &oid) &&
+ (!oidcmp(&item->commit->object.oid, &oid) ||
+ (opts->have_squash_onto &&
+ !oidcmp(&opts->squash_onto, &oid))))
+ to_amend = 1;
+
return res | error_with_patch(item->commit,
- item->arg, item->arg_len, opts, res,
- item->command == TODO_REWORD);
+ item->arg, item->arg_len, opts,
+ res, to_amend);
+ }
} else if (item->command == TODO_EXEC) {
char *end_of_arg = (char *)(item->arg + item->arg_len);
int saved = *end_of_arg;