{"thread":{"id":"46500","subject":"[PATCH 2/6] rebase: honor --rerere-autoupdate","startedAt":"2017-08-02T10:44:57Z","lastAt":"2017-08-07T10:17:15Z","messageCount":12,"participants":["Phillip Wood","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"325420","messageId":"20170802104420.12809-3-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 2/6] rebase: honor --rerere-autoupdate","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:16Z","receivedAt":"2017-08-02T10:44:57Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nRebase accepts '--rerere-autoupdate' as an option but only honors it\nif '-m' is also given. Fix it for a non-interactive rebase by passing\non the option to 'git am' and 'git cherry-pick'. Rework the tests so\nthat they can be used for each rebase flavor and extend them.\n\nReported-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n git-rebase--am.sh          |  3 +-\n t/t3418-rebase-continue.sh | 82 +++++++++++++++++++++++++++++++---------------\n 2 files changed, 57 insertions(+), 28 deletions(-)\n\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 375239341fbfe885e51a25e9e0dc2d4fee791345..319933e70a34f9da4ec93d063eb102eff33b6787 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -45,7 +45,7 @@ then\n \t# itself well to recording empty patches.  fortunately, cherry-pick\n \t# makes this easy\n \tgit cherry-pick ${gpg_sign_opt:+\"$gpg_sign_opt\"} --allow-empty \\\n-\t\t--right-only \"$revisions\" \\\n+\t\t$allow_rerere_autoupdate --right-only \"$revisions\" \\\n \t\t${restrict_revision+^$restrict_revision}\n \tret=$?\n else\n@@ -82,6 +82,7 @@ else\n \tfi\n \n \tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" \\\n+\t\t$allow_rerere_autoupdate \\\n \t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} <\"$GIT_DIR/rebased-patches\"\n \tret=$?\n \ndiff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh\nindex 4428b9086e8bcb383df801834d0de323f316f4fa..2b746f1559ad21a5ebf3bebd726c9a1b3d071c5a 100755\n--- a/t/t3418-rebase-continue.sh\n+++ b/t/t3418-rebase-continue.sh\n@@ -40,25 +40,6 @@ test_expect_success 'non-interactive rebase --continue works with touched file'\n \tgit rebase --continue\n '\n \n-test_expect_success 'non-interactive rebase --continue with rerere enabled' '\n-\ttest_config rerere.enabled true &&\n-\ttest_when_finished \"test_might_fail git rebase --abort\" &&\n-\tgit reset --hard commit-new-file-F2-on-topic-branch &&\n-\tgit checkout master &&\n-\trm -fr .git/rebase-* &&\n-\n-\ttest_must_fail git rebase --onto master master topic &&\n-\techo \"Resolved\" >F2 &&\n-\tgit add F2 &&\n-\tcp F2 F2.expected &&\n-\tgit rebase --continue &&\n-\n-\tgit reset --hard commit-new-file-F2-on-topic-branch &&\n-\tgit checkout master &&\n-\ttest_must_fail git rebase --onto master master topic &&\n-\ttest_cmp F2.expected F2\n-'\n-\n test_expect_success 'rebase --continue can not be used with other options' '\n \ttest_must_fail git rebase -v --continue &&\n \ttest_must_fail git rebase --continue -v\n@@ -93,25 +74,72 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '\n \ttest -f funny.was.run\n '\n \n-test_expect_success 'rebase --continue remembers --rerere-autoupdate' '\n+test_expect_success 'setup rerere database' '\n \trm -fr .git/rebase-* &&\n \tgit reset --hard commit-new-file-F3-on-topic-branch &&\n \tgit checkout master &&\n \ttest_commit \"commit-new-file-F3\" F3 3 &&\n-\tgit config rerere.enabled true &&\n+\ttest_config rerere.enabled true &&\n \ttest_must_fail git rebase -m master topic &&\n \techo \"Resolved\" >F2 &&\n+\tcp F2 expected-F2 &&\n \tgit add F2 &&\n \ttest_must_fail git rebase --continue &&\n \techo \"Resolved\" >F3 &&\n+\tcp F3 expected-F3 &&\n \tgit add F3 &&\n \tgit rebase --continue &&\n-\tgit reset --hard topic@{1} &&\n-\ttest_must_fail git rebase -m --rerere-autoupdate master &&\n-\ttest \"$(cat F2)\" = \"Resolved\" &&\n-\ttest_must_fail git rebase --continue &&\n-\ttest \"$(cat F3)\" = \"Resolved\" &&\n-\tgit rebase --continue\n+\tgit reset --hard topic@{1}\n '\n \n+prepare () {\n+\trm -fr .git/rebase-* &&\n+\tgit reset --hard commit-new-file-F3-on-topic-branch &&\n+\tgit checkout master &&\n+\ttest_config rerere.enabled true\n+}\n+\n+test_rerere_autoupdate () {\n+\taction=$1 &&\n+\ttest_expect_success \"rebase $action --continue remembers --rerere-autoupdate\" '\n+\t\tprepare &&\n+\t\ttest_must_fail git rebase $action --rerere-autoupdate master topic &&\n+\t\ttest_cmp expected-F2 F2 &&\n+\t\tgit diff-files --quiet &&\n+\t\ttest_must_fail git rebase --continue &&\n+\t\ttest_cmp expected-F3 F3 &&\n+\t\tgit diff-files --quiet &&\n+\t\tgit rebase --continue\n+\t'\n+\n+\ttest_expect_success \"rebase $action --continue honors rerere.autoUpdate\" '\n+\t\tprepare &&\n+\t\ttest_config rerere.autoupdate true &&\n+\t\ttest_must_fail git rebase $action master topic &&\n+\t\ttest_cmp expected-F2 F2 &&\n+\t\tgit diff-files --quiet &&\n+\t\ttest_must_fail git rebase --continue &&\n+\t\ttest_cmp expected-F3 F3 &&\n+\t\tgit diff-files --quiet &&\n+\t\tgit rebase --continue\n+\t'\n+\n+\ttest_expect_success \"rebase $action --continue remembers --no-rerere-autoupdate\" '\n+\t\tprepare &&\n+\t\ttest_config rerere.autoupdate true &&\n+\t\ttest_must_fail git rebase $action --no-rerere-autoupdate master topic &&\n+\t\ttest_cmp expected-F2 F2 &&\n+\t\ttest_must_fail git diff-files --quiet &&\n+\t\tgit add F2 &&\n+\t\ttest_must_fail git rebase --continue &&\n+\t\ttest_cmp expected-F3 F3 &&\n+\t\ttest_must_fail git diff-files --quiet &&\n+\t\tgit add F3 &&\n+\t\tgit rebase --continue\n+\t'\n+}\n+\n+test_rerere_autoupdate\n+test_rerere_autoupdate -m\n+\n test_done\n-- \n2.13.3\n\n"},{"id":"325421","messageId":"20170802104420.12809-1-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":null,"subject":"[PATCH 0/6] am/cherry-pick/rebase/revert --rerere-autoupdate fixes","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:14Z","receivedAt":"2017-08-02T10:44:59Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWith the exception of 'rebase -m' when continuing after stopping for\nthe user to resolve conflicts, they all forget the setting of\n--rerere-autoupdate.\n\nPhillip Wood (6):\n  am: remember --rerere-autoupdate setting\n  rebase: honor --rerere-autoupdate\n  rebase -i: honor --rerere-autoupdate\n  t3504: use test_commit\n  cherry-pick/revert: remember --rerere-autoupdate\n  cherry-pick/revert: reject --rerere-autoupdate when continuing\n\n builtin/am.c                  | 12 ++++++\n builtin/revert.c              |  2 +\n git-rebase--am.sh             |  3 +-\n git-rebase--interactive.sh    |  7 ++--\n sequencer.c                   | 20 +++++++++-\n t/t3418-rebase-continue.sh    | 85 +++++++++++++++++++++++++++-------------\n t/t3504-cherry-pick-rerere.sh | 90 +++++++++++++++++++++++++++++++++++--------\n 7 files changed, 170 insertions(+), 49 deletions(-)\n\n-- \n2.13.3\n\n"},{"id":"325422","messageId":"20170802104420.12809-7-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:20Z","receivedAt":"2017-08-02T10:45:01Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\ncherry-pick and revert should not accept --[no-]rerere-autoupdate once\nthey have started.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n\nThis will break scripts that pass --[no-]rerere-autoupdate to 'git\ncherry-pick --continue'. I don't think that this will be an issue for\nthe vast majority of users as I think most people will have assumed\nthat you cannot pass any other options with '--continue'.\n'--rerere-autoupdate' is mentioned by 'git cherry-pick -h' but it is\nnot mentioned in the documentation. Hopefully a note in the release\nnotes should be enough to alert anyone who is affected by this.\n\nbuiltin/revert.c              |  2 ++\n t/t3504-cherry-pick-rerere.sh | 13 +++++++++++++\n 2 files changed, 15 insertions(+)\n\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 16028b9ea82edee9cf41044c69a47e8994d78fc6..b9d927eb09c9ed87c84681df1396f4e6d9b13c97 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -155,6 +155,8 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)\n \t\t\t\t\"--strategy-option\", opts->xopts ? 1 : 0,\n \t\t\t\t\"-x\", opts->record_origin,\n \t\t\t\t\"--ff\", opts->allow_ff,\n+\t\t\t\t\"--rerere-autoupdate\", opts->allow_rerere_auto == RERERE_AUTOUPDATE,\n+\t\t\t\t\"--no-rerere-autoupdate\", opts->allow_rerere_auto == RERERE_NOAUTOUPDATE,\n \t\t\t\tNULL);\n \t}\n \ndiff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh\nindex af316cb40b7b16c95881eb8483eea4f6191c7cfa..a267b2d144df4a84f18ba4907b317e757ba98f16 100755\n--- a/t/t3504-cherry-pick-rerere.sh\n+++ b/t/t3504-cherry-pick-rerere.sh\n@@ -65,6 +65,19 @@ test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '\n \tgit reset --hard bar-dev\n '\n \n+test_expect_success 'cherry-pick --continue rejects --rerere-autoupdate' '\n+\ttest_must_fail git cherry-pick --rerere-autoupdate foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\tgit diff-files --quiet &&\n+\ttest_must_fail git cherry-pick --continue --rerere-autoupdate >actual 2>&1 &&\n+\techo \"fatal: cherry-pick: --rerere-autoupdate cannot be used with --continue\" >expect &&\n+\ttest_i18ncmp expect actual &&\n+\ttest_must_fail git cherry-pick --continue --no-rerere-autoupdate >actual 2>&1 &&\n+\techo \"fatal: cherry-pick: --no-rerere-autoupdate cannot be used with --continue\" >expect &&\n+\ttest_i18ncmp expect actual &&\n+\tgit cherry-pick --abort\n+'\n+\n test_expect_success 'cherry-pick --rerere-autoupdate more than once' '\n \ttest_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-master &&\n \ttest_cmp foo-expect foo &&\n-- \n2.13.3\n\n"},{"id":"325423","messageId":"20170802104420.12809-2-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 1/6] am: remember --rerere-autoupdate setting","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:15Z","receivedAt":"2017-08-02T10:45:04Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nSave the rerere-autoupdate setting so that it is remembered after\nstopping for the user to resolve conflicts.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n\nThere are no new tests, but this code is exercised by the new rebase\ntests in the next patch.\n\nbuiltin/am.c | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex c973bd96dcb5d630d56e935733bfa4530ccd2872..6962d4db5ffceef3022b7f877a43c8833a839b31 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -431,6 +431,14 @@ static void am_load(struct am_state *state)\n \tread_state_file(&sb, state, \"utf8\", 1);\n \tstate->utf8 = !strcmp(sb.buf, \"t\");\n \n+\tif (file_exists(am_path(state, \"rerere-autoupdate\"))) {\n+\t\tread_state_file(&sb, state, \"rerere-autoupdate\", 1);\n+\t\tstate->allow_rerere_autoupdate = strcmp(sb.buf, \"t\") ?\n+\t\t\tRERERE_NOAUTOUPDATE : RERERE_AUTOUPDATE;\n+\t} else {\n+\t\tstate->allow_rerere_autoupdate = 0;\n+\t}\n+\n \tread_state_file(&sb, state, \"keep\", 1);\n \tif (!strcmp(sb.buf, \"t\"))\n \t\tstate->keep = KEEP_TRUE;\n@@ -1003,6 +1011,10 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,\n \twrite_state_bool(state, \"sign\", state->signoff);\n \twrite_state_bool(state, \"utf8\", state->utf8);\n \n+\tif (state->allow_rerere_autoupdate)\n+\t\twrite_state_bool(state, \"rerere-autoupdate\",\n+\t\t\t state->allow_rerere_autoupdate == RERERE_AUTOUPDATE);\n+\n \tswitch (state->keep) {\n \tcase KEEP_FALSE:\n \t\tstr = \"f\";\n-- \n2.13.3\n\n"},{"id":"325424","messageId":"20170802104420.12809-4-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 3/6] rebase -i: honor --rerere-autoupdate","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:17Z","receivedAt":"2017-08-02T10:45:06Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nInteractive rebase was ignoring '--rerere-autoupdate'. Fix this by\nreading it appropriate file when restoring the sequencer state for an\ninteractive rebase and passing '--rerere-autoupdate' to merge and\ncherry-pick when rebasing with '--preserve-merges'.\n\nReported-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n git-rebase--interactive.sh |  7 ++++---\n sequencer.c                | 10 ++++++++++\n t/t3418-rebase-continue.sh |  3 +++\n 3 files changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 90b1fbe9cf6e8dfb2f4331916809fa40bf9050d2..29b7e8824b53abeaa68780b95d5954f67f734098 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -281,7 +281,7 @@ pick_one () {\n \n \ttest -d \"$rewritten\" &&\n \t\tpick_one_preserving_merges \"$@\" && return\n-\toutput eval git cherry-pick \\\n+\toutput eval git cherry-pick $allow_rerere_autoupdate \\\n \t\t\t${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")} \\\n \t\t\t\"$strategy_args\" $empty_args $ff \"$@\"\n \n@@ -393,7 +393,8 @@ pick_one_preserving_merges () {\n \t\t\tmerge_args=\"--no-log --no-ff\"\n \t\t\tif ! do_with_author output eval \\\n \t\t\t'git merge ${gpg_sign_opt:+\"$gpg_sign_opt\"} \\\n-\t\t\t\t$merge_args $strategy_args -m \"$msg_content\" $new_parents'\n+\t\t\t\t$allow_rerere_autoupdate $merge_args \\\n+\t\t\t\t$strategy_args -m \"$msg_content\" $new_parents'\n \t\t\tthen\n \t\t\t\tprintf \"%s\\n\" \"$msg_content\" > \"$GIT_DIR\"/MERGE_MSG\n \t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Error redoing merge \\$sha1\")\"\n@@ -401,7 +402,7 @@ pick_one_preserving_merges () {\n \t\t\techo \"$sha1 $(git rev-parse HEAD^0)\" >> \"$rewritten_list\"\n \t\t\t;;\n \t\t*)\n-\t\t\toutput eval git cherry-pick \\\n+\t\t\toutput eval git cherry-pick $allow_rerere_autoupdate \\\n \t\t\t\t${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")} \\\n \t\t\t\t\"$strategy_args\" \"$@\" ||\n \t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Could not pick \\$sha1\")\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 3010faf86398697469e903318a35421d911acb23..7dc0670d902291b8054072d32cc0c8979c13598c 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -127,6 +127,7 @@ static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n static GIT_PATH_FUNC(rebase_path_autostash, \"rebase-merge/autostash\")\n static GIT_PATH_FUNC(rebase_path_strategy, \"rebase-merge/strategy\")\n static GIT_PATH_FUNC(rebase_path_strategy_opts, \"rebase-merge/strategy_opts\")\n+static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, \"rebase-merge/allow_rerere_autoupdate\")\n \n static inline int is_rebase_i(const struct replay_opts *opts)\n {\n@@ -1479,6 +1480,15 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\t\t\tfree(opts->gpg_sign);\n \t\t\t\topts->gpg_sign = xstrdup(buf.buf + 2);\n \t\t\t}\n+\t\t\tstrbuf_reset(&buf);\n+\t\t}\n+\n+\t\tif (read_oneliner(&buf, rebase_path_allow_rerere_autoupdate(), 1)) {\n+\t\t\tif (!strcmp(buf.buf, \"--rerere-autoupdate\"))\n+\t\t\t\topts->allow_rerere_auto = RERERE_AUTOUPDATE;\n+\t\t\telse if (!strcmp(buf.buf, \"--no-rerere-autoupdate\"))\n+\t\t\t\topts->allow_rerere_auto = RERERE_NOAUTOUPDATE;\n+\t\t\tstrbuf_reset(&buf);\n \t\t}\n \n \t\tif (file_exists(rebase_path_verbose()))\ndiff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh\nindex 2b746f1559ad21a5ebf3bebd726c9a1b3d071c5a..fcfdd197bd352a9dca10233c2ba6d2aa4a66149e 100755\n--- a/t/t3418-rebase-continue.sh\n+++ b/t/t3418-rebase-continue.sh\n@@ -141,5 +141,8 @@ test_rerere_autoupdate () {\n \n test_rerere_autoupdate\n test_rerere_autoupdate -m\n+GIT_SEQUENCE_EDITOR=: && export GIT_SEQUENCE_EDITOR\n+test_rerere_autoupdate -i\n+test_rerere_autoupdate --preserve-merges\n \n test_done\n-- \n2.13.3\n\n"},{"id":"325425","messageId":"20170802104420.12809-6-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 5/6] cherry-pick/revert: remember --rerere-autoupdate","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:19Z","receivedAt":"2017-08-02T10:45:09Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nWhen continuing after conflicts, cherry-pick forgot if the user had specified\n'--rerere-autoupdate'.\n\nRedo the cherry-pick rerere tests to check --rerere-autoupdate works\nas expected.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n sequencer.c                   | 10 +++++++-\n t/t3504-cherry-pick-rerere.sh | 60 ++++++++++++++++++++++++++++++++++++++-----\n 2 files changed, 62 insertions(+), 8 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 7dc0670d902291b8054072d32cc0c8979c13598c..e0e66b987b27072da4aea6304a565ab708be91e4 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1439,7 +1439,11 @@ static int populate_opts_cb(const char *key, const char *value, void *data)\n \telse if (!strcmp(key, \"options.strategy-option\")) {\n \t\tALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);\n \t\topts->xopts[opts->xopts_nr++] = xstrdup(value);\n-\t} else\n+\t} else if (!strcmp(key, \"options.allow-rerere-auto\"))\n+\t\topts->allow_rerere_auto =\n+\t\t\tgit_config_bool_or_int(key, value, &error_flag) ?\n+\t\t\t\tRERERE_AUTOUPDATE : RERERE_NOAUTOUPDATE;\n+\telse\n \t\treturn error(_(\"invalid key: %s\"), key);\n \n \tif (!error_flag)\n@@ -1752,6 +1756,10 @@ static int save_opts(struct replay_opts *opts)\n \t\t\t\t\t\t\t\"options.strategy-option\",\n \t\t\t\t\t\t\topts->xopts[i], \"^$\", 0);\n \t}\n+\tif (opts->allow_rerere_auto)\n+\t\tres |= git_config_set_in_file_gently(opts_file, \"options.allow-rerere-auto\",\n+\t\t\t\t\t\t     opts->allow_rerere_auto == RERERE_AUTOUPDATE ?\n+\t\t\t\t\t\t     \"true\" : \"false\");\n \treturn res;\n }\n \ndiff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh\nindex 33f902b1b0d8eb651e0e6857f8f5b86ef633ef4a..af316cb40b7b16c95881eb8483eea4f6191c7cfa 100755\n--- a/t/t3504-cherry-pick-rerere.sh\n+++ b/t/t3504-cherry-pick-rerere.sh\n@@ -7,9 +7,11 @@ test_description='cherry-pick should rerere for conflicts'\n test_expect_success setup '\n \ttest_commit foo &&\n \ttest_commit foo-master foo &&\n+\ttest_commit bar-master bar &&\n \n \tgit checkout -b dev foo &&\n \ttest_commit foo-dev foo &&\n+\ttest_commit bar-dev bar &&\n \tgit config rerere.enabled true\n '\n \n@@ -19,22 +21,66 @@ test_expect_success 'conflicting merge' '\n \n test_expect_success 'fixup' '\n \techo foo-resolved >foo &&\n+\techo bar-resolved >bar &&\n \tgit commit -am resolved &&\n-\tcp foo expect &&\n+\tcp foo foo-expect &&\n+\tcp bar bar-expect &&\n \tgit reset --hard HEAD^\n '\n \n-test_expect_success 'cherry-pick conflict' '\n-\ttest_must_fail git cherry-pick master &&\n-\ttest_cmp expect foo\n+test_expect_success 'cherry-pick conflict with --rerere-autoupdate' '\n+\ttest_must_fail git cherry-pick --rerere-autoupdate foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\tgit diff-files --quiet &&\n+\ttest_must_fail git cherry-pick --continue &&\n+\ttest_cmp bar-expect bar &&\n+\tgit diff-files --quiet &&\n+\tgit cherry-pick --continue &&\n+\tgit reset --hard bar-dev\n '\n \n-test_expect_success 'reconfigure' '\n-\tgit config rerere.enabled false &&\n-\tgit reset --hard\n+test_expect_success 'cherry-pick conflict repsects rerere.autoUpdate' '\n+\ttest_config rerere.autoUpdate true &&\n+\ttest_must_fail git cherry-pick foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\tgit diff-files --quiet &&\n+\ttest_must_fail git cherry-pick --continue &&\n+\ttest_cmp bar-expect bar &&\n+\tgit diff-files --quiet &&\n+\tgit cherry-pick --continue &&\n+\tgit reset --hard bar-dev\n+'\n+\n+test_expect_success 'cherry-pick conflict with --no-rerere-autoupdate' '\n+\ttest_config rerere.autoUpdate true &&\n+\ttest_must_fail git cherry-pick --no-rerere-autoupdate foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\ttest_must_fail git diff-files --quiet &&\n+\tgit add foo &&\n+\ttest_must_fail git cherry-pick --continue &&\n+\ttest_cmp bar-expect bar &&\n+\ttest_must_fail git diff-files --quiet &&\n+\tgit add bar &&\n+\tgit cherry-pick --continue &&\n+\tgit reset --hard bar-dev\n+'\n+\n+test_expect_success 'cherry-pick --rerere-autoupdate more than once' '\n+\ttest_must_fail git cherry-pick --rerere-autoupdate --rerere-autoupdate foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\tgit diff-files --quiet &&\n+\tgit cherry-pick --abort &&\n+\ttest_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate --rerere-autoupdate foo..bar-master &&\n+\ttest_cmp foo-expect foo &&\n+\tgit diff-files --quiet &&\n+\tgit cherry-pick --abort &&\n+\ttest_must_fail git cherry-pick --rerere-autoupdate --no-rerere-autoupdate foo..bar-master &&\n+\ttest_must_fail git diff-files --quiet &&\n+\tgit cherry-pick --abort\n '\n \n test_expect_success 'cherry-pick conflict without rerere' '\n+\ttest_config rerere.enabled false &&\n \ttest_must_fail git cherry-pick master &&\n \ttest_must_fail test_cmp expect foo\n '\n-- \n2.13.3\n\n"},{"id":"325426","messageId":"20170802104420.12809-5-phillip.wood@talktalk.net","threadId":"46500","inReplyTo":"20170802104420.12809-1-phillip.wood@talktalk.net","subject":"[PATCH 4/6] t3504: use test_commit","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-02T10:44:18Z","receivedAt":"2017-08-02T10:45:11Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"From: Phillip Wood <phillip.wood@dunelm.org.uk>\n\nUsing test_commit is simpler than chaining echo && git add &&\ntest_tick && commit. Also having tags makes it clearer which commit\nis being selecting by reset.\n\nSigned-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>\n---\n t/t3504-cherry-pick-rerere.sh | 19 ++++++++-----------\n 1 file changed, 8 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh\nindex e6a64816efef0e53018c7a56784d1af62602e9d3..33f902b1b0d8eb651e0e6857f8f5b86ef633ef4a 100755\n--- a/t/t3504-cherry-pick-rerere.sh\n+++ b/t/t3504-cherry-pick-rerere.sh\n@@ -5,14 +5,11 @@ test_description='cherry-pick should rerere for conflicts'\n . ./test-lib.sh\n \n test_expect_success setup '\n-\techo foo >foo &&\n-\tgit add foo && test_tick && git commit -q -m 1 &&\n-\techo foo-master >foo &&\n-\tgit add foo && test_tick && git commit -q -m 2 &&\n+\ttest_commit foo &&\n+\ttest_commit foo-master foo &&\n \n-\tgit checkout -b dev HEAD^ &&\n-\techo foo-dev >foo &&\n-\tgit add foo && test_tick && git commit -q -m 3 &&\n+\tgit checkout -b dev foo &&\n+\ttest_commit foo-dev foo &&\n \tgit config rerere.enabled true\n '\n \n@@ -21,10 +18,10 @@ test_expect_success 'conflicting merge' '\n '\n \n test_expect_success 'fixup' '\n-\techo foo-dev >foo &&\n-\tgit add foo && test_tick && git commit -q -m 4 &&\n-\tgit reset --hard HEAD^ &&\n-\techo foo-dev >expect\n+\techo foo-resolved >foo &&\n+\tgit commit -am resolved &&\n+\tcp foo expect &&\n+\tgit reset --hard HEAD^\n '\n \n test_expect_success 'cherry-pick conflict' '\n-- \n2.13.3\n\n"},{"id":"325483","messageId":"xmqqpocdr5tu.fsf@gitster.mtv.corp.google.com","threadId":"46500","inReplyTo":"20170802104420.12809-7-phillip.wood@talktalk.net","subject":"Re: [PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-02T21:57:17Z","receivedAt":"2017-08-02T21:57:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood@talktalk.net> writes:\n\n> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>\n> cherry-pick and revert should not accept --[no-]rerere-autoupdate once\n> they have started.\n\nHmph, why shouldn't they?  In other words, shouldn't the usual \"try\nto carry forward from the original invocation (saved in the state\nfile), but allow overriding from the command line\" rule apply?\n\nI took a brief look at earlier steps and I thought 1-4/6 were all\ngood.  I am not sure (yet) about these last two patches.\n\nThanks for working on this topic.\n"},{"id":"325490","messageId":"xmqqlgn1r4bu.fsf@gitster.mtv.corp.google.com","threadId":"46500","inReplyTo":"xmqqpocdr5tu.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-02T22:29:41Z","receivedAt":"2017-08-02T22:29:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Phillip Wood <phillip.wood@talktalk.net> writes:\n>\n>> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>>\n>> cherry-pick and revert should not accept --[no-]rerere-autoupdate once\n>> they have started.\n>\n> Hmph, why shouldn't they?  In other words, shouldn't the usual \"try\n> to carry forward from the original invocation (saved in the state\n> file), but allow overriding from the command line\" rule apply?\n\nActually, I do not care _too_ deeply between\n\n * You can only give \"--[no-]rerere-autoupdate\" at the beginning and\n   cannot change your mind later.\n\nand\n\n * The \"--[no-]rerere-autoupdate\" you give at the beginning is used\n   throughout your multi-commit cherry-pick session, but you can\n   give an opposite one from the command line when you say\n   \"--continue\", and in that case it takes effect only for a single\n   commit.\n\nIf I understand correctly, the former is what 5-6/6 implements.  The\nlatter makes it more in line with how \"am -3\" followed by \"am --no-3\n--continue\" behaves.\n\nThanks.\n"},{"id":"325545","messageId":"6a7c9661-9f12-99c9-1fc1-4a4abd3d0660@talktalk.net","threadId":"46500","inReplyTo":"xmqqlgn1r4bu.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-03T10:15:48Z","receivedAt":"2017-08-03T10:15:56Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Junio\n\nThanks for your comments.\n\nOn 02/08/17 23:29, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> Phillip Wood <phillip.wood@talktalk.net> writes:\n>>\n>>> From: Phillip Wood <phillip.wood@dunelm.org.uk>\n>>>\n>>> cherry-pick and revert should not accept --[no-]rerere-autoupdate once\n>>> they have started.\n>>\n>> Hmph, why shouldn't they?  In other words, shouldn't the usual \"try\n>> to carry forward from the original invocation (saved in the state\n>> file), but allow overriding from the command line\" rule apply?\n> \n> Actually, I do not care _too_ deeply between\n> \n>  * You can only give \"--[no-]rerere-autoupdate\" at the beginning and\n>    cannot change your mind later.\n> \n> and\n> \n>  * The \"--[no-]rerere-autoupdate\" you give at the beginning is used\n>    throughout your multi-commit cherry-pick session, but you can\n>    give an opposite one from the command line when you say\n>    \"--continue\", and in that case it takes effect only for a single\n>    commit.\n> \n> If I understand correctly, the former is what 5-6/6 implements.\n\nYes, that's correct. It was easier to implement it that way\n\n> The\n> latter makes it more in line with how \"am -3\" followed by \"am --no-3\n> --continue\" behaves.\n\nI'm a bit confused about what am does when you pass extra options to\n--continue. It looks like they do not persist if there's another\nconflict and may only apply to the first patch that is applied when\nresuming - I'd need to spend more time looking at the code or run a test\nto be sure.\n\nBest Wishes\n\nPhillip\n\n\n"},{"id":"325550","messageId":"xmqqy3r0po0i.fsf@gitster.mtv.corp.google.com","threadId":"46500","inReplyTo":"6a7c9661-9f12-99c9-1fc1-4a4abd3d0660@talktalk.net","subject":"Re: [PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-03T17:19:41Z","receivedAt":"2017-08-03T17:19:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood@talktalk.net> writes:\n\n> On 02/08/17 23:29, Junio C Hamano wrote:\n> ...\n>> The\n>> latter makes it more in line with how \"am -3\" followed by \"am --no-3\n>> --continue\" behaves.\n>\n> I'm a bit confused about what am does when you pass extra options to\n> --continue. It looks like they do not persist if there's another\n> conflict and may only apply to the first patch that is applied when\n> resuming - I'd need to spend more time looking at the code or run a test\n> to be sure.\n\nI think you got what \"am\" wants to do.  \n\nThe idea is that the user would say she does not trust the three-way\nfallback when she starts to apply many patches in an mbox, i.e.\n\n   $ git am mbox\n\nUpon seeing a message that does not apply, she would examine the\npatch that caused _this_ stoppage, and then decide that it is safe\nto apply _this_ patch (but not necessarily later ones) with\nthree-way fallback and move on:\n\n    $ git am -3 --continue\n\nI have not thought too deeply if the parallel applies to\nmulti-commit pick, though.  \n\n\"am\" (rather, its underlying machinery \"apply\") is designed to be\nall-or-none, so a failed --no-3way application would leave the index\nand the working tree intact.  \"-3 --continue\" can retry the failed\nstep, with \"--3way\" processing turned on for only one message, from\nthat state.\n\nBut a multi-commit cherry-pick/revert would stop _after_ it munges\nthe conflicted paths in the index into an unmerged state and writes\nthe conflicted state into the working tree files.  For \"--continue\n--rerere-autoupdate\" to work more like \"am --continue -3\", it would\nhave to learn to reset to the state before the failed cherry-pick\nfirst, before re-attempting the failed cherry-pick with the auto\nupdate enabled only for the single commit and keep going.  So it may\nnot as trivial as \"am --continue\", even though it sounds doable.\n\n\n\n"},{"id":"325672","messageId":"bcaccf25-b033-259b-9ca7-b77a7240029b@talktalk.net","threadId":"46500","inReplyTo":"xmqqy3r0po0i.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 6/6] cherry-pick/revert: reject --rerere-autoupdate when continuing","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2017-08-07T10:17:04Z","receivedAt":"2017-08-07T10:17:15Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 03/08/17 18:19, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood@talktalk.net> writes:\n> \n>> On 02/08/17 23:29, Junio C Hamano wrote:\n>> ...\n>>> The\n>>> latter makes it more in line with how \"am -3\" followed by \"am --no-3\n>>> --continue\" behaves.\n>>\n>> I'm a bit confused about what am does when you pass extra options to\n>> --continue. It looks like they do not persist if there's another\n>> conflict and may only apply to the first patch that is applied when\n>> resuming - I'd need to spend more time looking at the code or run a test\n>> to be sure.\n> \n> I think you got what \"am\" wants to do.  \n> \n> The idea is that the user would say she does not trust the three-way\n> fallback when she starts to apply many patches in an mbox, i.e.\n> \n>    $ git am mbox\n> \n> Upon seeing a message that does not apply, she would examine the\n> patch that caused _this_ stoppage, and then decide that it is safe\n> to apply _this_ patch (but not necessarily later ones) with\n> three-way fallback and move on:\n> \n>     $ git am -3 --continue\n> \n> I have not thought too deeply if the parallel applies to\n> multi-commit pick, though.  \n> \n> \"am\" (rather, its underlying machinery \"apply\") is designed to be\n> all-or-none, so a failed --no-3way application would leave the index\n> and the working tree intact.  \"-3 --continue\" can retry the failed\n> step, with \"--3way\" processing turned on for only one message, from\n> that state.\n> \n> But a multi-commit cherry-pick/revert would stop _after_ it munges\n> the conflicted paths in the index into an unmerged state and writes\n> the conflicted state into the working tree files.  For \"--continue\n> --rerere-autoupdate\" to work more like \"am --continue -3\", it would\n> have to learn to reset to the state before the failed cherry-pick\n> first, before re-attempting the failed cherry-pick with the auto\n> update enabled only for the single commit and keep going.  So it may\n> not as trivial as \"am --continue\", even though it sounds doable.\n> \nThanks for explaining that, as you say having cherry-pick take\n'--rerere-autoupadate' with '--continue' sounds more complicated than\nthe am case. Also I'm not sure it would be as helpful to toggle\n'--rerere-autoupdate' with cherry-pick as it is to toggle '--3way' with\nam as it's not that hard for the user to stage the merged files\nthemselves. If you're happy with the way it is currently implemented I'm\nnot inclined to change it.\n\nThanks\n\nPhillip\n"}]}