Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- sequencer.c | 10 +++++++++- t/t3504-cherry-pick-rerere.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/sequencer.c b/sequencer.c index c01ad08..a258627 100644 --- a/sequencer.c +++ b/sequencer.c @@ -820,7 +820,9 @@ static int populate_opts_cb(const char *key, const char *value, void *data) else if (!strcmp(key, "options.strategy-option")) { ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc); opts->xopts[opts->xopts_nr++] = xstrdup(value); - } else + } else if (!strcmp(key, "options.allow-rerere-auto")) + opts->allow_rerere_auto = git_config_int(key, value); + else return error(_("Invalid key: %s"), key); if (!error_flag) @@ -997,6 +999,12 @@ static void save_opts(struct replay_opts *opts) "options.strategy-option", opts->xopts[i], "^$", 0); } + if (opts->allow_rerere_auto) { + struct strbuf buf = STRBUF_INIT; + strbuf_addf(&buf, "%d", opts->allow_rerere_auto); + git_config_set_in_file(opts_file, "options.allow-rerere-auto", buf.buf); + strbuf_release(&buf); + } } static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts) diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh index e6a6481..274b2cc 100755 --- a/t/t3504-cherry-pick-rerere.sh +++ b/t/t3504-cherry-pick-rerere.sh @@ -42,4 +42,43 @@ test_expect_success 'cherry-pick conflict without rerere' ' test_must_fail test_cmp expect foo ' +test_expect_success 'cherry-pick --rerere-autoupdate' ' + test_when_finished "rm -rf rerere" && + ( + git init rerere && + cd rerere && + test_config rerere.enabled true && + echo one > content-a && git add content-a && + echo one > content-b && git add content-b && + git commit -m one && + git checkout -b conflict master && + echo conflict-a > content-a && + git commit -a -m conflict-a && + echo conflict-b > content-b && + git commit -a -m conflict-b && + git checkout master && + echo two > content-a && + echo two > content-b && + git commit -a -m two && + git checkout -b test && + test_must_fail git cherry-pick master..conflict && + echo resolved-a > content-a && + git add content-a && + test_must_fail git cherry-pick --continue && + echo resolved-b > content-b && + git add content-b && + git cherry-pick --continue && + git reset --hard master + git log --oneline --all --decorate --graph && + test_must_fail git cherry-pick --rerere-autoupdate master..conflict && + git log --oneline --all --decorate --graph && + echo resolved-a > expected && + test_cmp expected content-a + test_must_fail git cherry-pick --continue && + echo resolved-b > expected && + test_cmp expected content-b && + git cherry-pick --continue + ) +' + test_done -- 1.9.2+fc1.2.gfbaae8c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html