{"thread":{"id":"49781","subject":"[PATCH v2 1/2] git-rebase, sequencer: extend --quiet option for the interactive machinery","startedAt":"2018-11-08T06:02:12Z","lastAt":"2019-02-21T17:44:54Z","messageCount":67,"participants":["Elijah Newren","Johannes Schindelin","Phillip Wood","Duy Nguyen","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"362717","messageId":"20181108060158.27145-2-newren@gmail.com","threadId":"49781","inReplyTo":"20181108060158.27145-1-newren@gmail.com","subject":"[PATCH v2 1/2] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-08T06:01:57Z","receivedAt":"2018-11-08T06:02:12Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"While 'quiet' and 'interactive' may sound like antonyms, the interactive\nmachinery actually has logic that implements several\ninteractive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\nwhich won't pop up an editor.  The rewrite of interactive rebase in C\nadded a quiet option, though it only turns stats off.  Since we want to\nmake the interactive machinery also take over for git-rebase--merge, it\nshould fully implement the --quiet option.\n\ngit-rebase--interactive was already somewhat quieter than\ngit-rebase--merge and git-rebase--am, possibly because cherry-pick has\njust traditionally been quieter.  As such, we only drop a few\ninformational messages -- \"Rebasing (n/m)\" and \"Succesfully rebased...\"\n\nAlso, for simplicity, remove the differences in how quiet and verbose\noptions were recorded.  Having one be signalled by the presence of a\n\"verbose\" file in the state_dir, while the other was signalled by the\ncontents of a \"quiet\" file was just weirdly inconsistent.  (This\ninconsistency pre-dated the rewrite into C.)  Make them consistent by\nhaving them both key off the presence of the file.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c      |  5 +----\n git-legacy-rebase.sh  |  2 +-\n git-rebase--common.sh |  2 +-\n sequencer.c           | 23 +++++++++++++----------\n sequencer.h           |  1 +\n 5 files changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 0ee06aa363..be004406a6 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -181,10 +181,7 @@ static int read_basic_state(struct rebase_options *opts)\n \tif (get_oid(buf.buf, &opts->orig_head))\n \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n \n-\tstrbuf_reset(&buf);\n-\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n-\t\treturn -1;\n-\tif (buf.len)\n+\tif (file_exists(state_dir_path(\"quiet\", opts)))\n \t\topts->flags &= ~REBASE_NO_QUIET;\n \telse\n \t\topts->flags |= REBASE_NO_QUIET;\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 75a08b2683..da27bfca5a 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -113,7 +113,7 @@ read_basic_state () {\n \telse\n \t\torig_head=$(cat \"$state_dir\"/head)\n \tfi &&\n-\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n+\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n \ttest -f \"$state_dir\"/verbose && verbose=t\n \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n \ttest -f \"$state_dir\"/strategy_opts &&\ndiff --git a/git-rebase--common.sh b/git-rebase--common.sh\nindex 7e39d22871..dc18c682fa 100644\n--- a/git-rebase--common.sh\n+++ b/git-rebase--common.sh\n@@ -10,7 +10,7 @@ write_basic_state () {\n \techo \"$head_name\" > \"$state_dir\"/head-name &&\n \techo \"$onto\" > \"$state_dir\"/onto &&\n \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n-\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n+\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\ndiff --git a/sequencer.c b/sequencer.c\nindex 9e1ab3a2a7..bd8337dbf1 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n+static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n@@ -157,7 +158,6 @@ 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-static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n \n static int git_sequencer_config(const char *k, const char *v, void *cb)\n {\n@@ -2307,6 +2307,9 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\tif (file_exists(rebase_path_verbose()))\n \t\t\topts->verbose = 1;\n \n+\t\tif (file_exists(rebase_path_quiet()))\n+\t\t\topts->quiet = 1;\n+\n \t\tif (file_exists(rebase_path_signoff())) {\n \t\t\topts->allow_ff = 0;\n \t\t\topts->signoff = 1;\n@@ -2374,9 +2377,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n \n \tif (quiet)\n \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n-\telse\n-\t\twrite_file(rebase_path_quiet(), \"\\n\");\n-\n \tif (opts->verbose)\n \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n \tif (opts->strategy)\n@@ -3450,10 +3450,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n \t\t\t\t\tfclose(f);\n \t\t\t\t}\n-\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n-\t\t\t\t\ttodo_list->done_nr,\n-\t\t\t\t\ttodo_list->total_nr,\n-\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n+\t\t\t\tif (!opts->quiet)\n+\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n+\t\t\t\t\t\ttodo_list->done_nr,\n+\t\t\t\t\t\ttodo_list->total_nr,\n+\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n \t\t\t}\n \t\t\tunlink(rebase_path_message());\n \t\t\tunlink(rebase_path_author_script());\n@@ -3684,8 +3685,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t}\n \t\tapply_autostash(opts);\n \n-\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n-\t\t\thead_ref.buf);\n+\t\tif (!opts->quiet)\n+\t\t\tfprintf(stderr,\n+\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n+\t\t\t\thead_ref.buf);\n \n \t\tstrbuf_release(&buf);\n \t\tstrbuf_release(&head_ref);\ndiff --git a/sequencer.h b/sequencer.h\nindex 660cff5050..45fd977bef 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -39,6 +39,7 @@ struct replay_opts {\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n \tint verbose;\n+\tint quiet;\n \n \tint mainline;\n \n-- \n2.19.1.858.g526e8fe740.dirty\n\n"},{"id":"362718","messageId":"20181108060158.27145-3-newren@gmail.com","threadId":"49781","inReplyTo":"20181108060158.27145-1-newren@gmail.com","subject":"[PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-08T06:01:58Z","receivedAt":"2018-11-08T06:02:14Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Interactive rebases are implemented in terms of cherry-pick rather than\nthe merge-recursive builtin, but cherry-pick also calls into the recursive\nmerge machinery by default and can accept special merge strategies and/or\nspecial strategy options.  As such, there really is not any need for\nhaving both git-rebase--merge and git-rebase--interactive anymore.\n\nDelete git-rebase--merge.sh and have the --merge option be implemented\nby the now built-in interactive machinery.\n\nNote that this change fixes a few known test failures (see t3421).\n\ntestcase modification notes:\n  t3406: --interactive and --merge had slightly different progress output\n         while running; adjust a test to match\n  t3420: these test precise output while running, but rebase--am,\n         rebase--merge, and rebase--interactive all were built on very\n         different commands (am, merge-recursive, cherry-pick), so the\n         tests expected different output for each type.  Now we expect\n         --merge and --interactive to have the same output.\n  t3421: --interactive fixes some bugs in --merge!  Wahoo!\n  t3425: topology linearization was inconsistent across flavors of rebase,\n         as already noted in a TODO comment in the testcase.  This was not\n         considered a bug before, so getting a different linearization due\n         to switching out backends should not be considered a bug now.\n  t5407: different rebase types varied slightly in how many times checkout\n         or commit or equivalents were called based on a quick comparison\n         of this tests and previous ones which covered different rebase\n         flavors.  I think this is just attributable to this difference.\n  t9903: --merge uses the interactive backend so the prompt expected is\n         now REBASE-i.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +---\n Makefile                          |   1 -\n builtin/rebase.c                  |  10 +-\n git-legacy-rebase.sh              |  55 +++++-----\n git-rebase--merge.sh              | 164 ------------------------------\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t3425-rebase-topology-merges.sh |   6 +-\n t/t5407-post-rewrite-hook.sh      |   1 +\n t/t9903-bash-prompt.sh            |   2 +-\n 12 files changed, 50 insertions(+), 302 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 0d77ea5894..910b1d2d2f 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -124,7 +124,6 @@\n /git-rebase--am\n /git-rebase--common\n /git-rebase--interactive\n-/git-rebase--merge\n /git-rebase--preserve-merges\n /git-receive-pack\n /git-reflog\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 3407d835bd..35084f5681 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n INCOMPATIBLE OPTIONS\n --------------------\n \n-git-rebase has many flags that are incompatible with each other,\n-predominantly due to the fact that it has three different underlying\n-implementations:\n-\n- * one based on linkgit:git-am[1] (the default)\n- * one based on git-merge-recursive (merge backend)\n- * one based on linkgit:git-cherry-pick[1] (interactive backend)\n-\n-Flags only understood by the am backend:\n+The following options:\n \n  * --committer-date-is-author-date\n  * --ignore-date\n@@ -520,15 +512,12 @@ Flags only understood by the am backend:\n  * --ignore-whitespace\n  * -C\n \n-Flags understood by both merge and interactive backends:\n+are incompatible with the following options:\n \n  * --merge\n  * --strategy\n  * --strategy-option\n  * --allow-empty-message\n-\n-Flags only understood by the interactive backend:\n-\n  * --[no-]autosquash\n  * --rebase-merges\n  * --preserve-merges\n@@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n  * --edit-todo\n  * --root when used in combination with --onto\n \n-Other incompatible flag pairs:\n+In addition, the following pairs of options are incompatible:\n \n  * --preserve-merges and --interactive\n  * --preserve-merges and --signoff\ndiff --git a/Makefile b/Makefile\nindex bbfbb4292d..18e79fdea8 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -628,7 +628,6 @@ SCRIPT_LIB += git-parse-remote\n SCRIPT_LIB += git-rebase--am\n SCRIPT_LIB += git-rebase--common\n SCRIPT_LIB += git-rebase--preserve-merges\n-SCRIPT_LIB += git-rebase--merge\n SCRIPT_LIB += git-sh-setup\n SCRIPT_LIB += git-sh-i18n\n \ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex be004406a6..d55bbb9eb9 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -118,7 +118,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbreak;\n \tcase REBASE_MERGE:\n-\t\t/* we silently *upgrade* --merge to --interactive if needed */\n+\t\t/* we now implement --merge via --interactive */\n \tdefault:\n \t\topts->type = REBASE_INTERACTIVE; /* implied */\n \t\tbreak;\n@@ -475,10 +475,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n \t\tbackend = \"git-rebase--am\";\n \t\tbackend_func = \"git_rebase__am\";\n \t\tbreak;\n-\tcase REBASE_MERGE:\n-\t\tbackend = \"git-rebase--merge\";\n-\t\tbackend_func = \"git_rebase__merge\";\n-\t\tbreak;\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbackend = \"git-rebase--preserve-merges\";\n \t\tbackend_func = \"git_rebase__preserve_merges\";\n@@ -1156,6 +1152,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \t}\n \n+\tif (options.type == REBASE_MERGE) {\n+\t\timply_interactive(&options, \"--merge\");\n+\t}\n+\n \tif (options.root && !options.onto_name)\n \t\timply_interactive(&options, \"--root without --onto\");\n \ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex da27bfca5a..4abcceed06 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -218,6 +218,7 @@ then\n \tstate_dir=\"$apply_dir\"\n elif test -d \"$merge_dir\"\n then\n+\ttype=interactive\n \tif test -d \"$merge_dir\"/rewritten\n \tthen\n \t\ttype=preserve-merges\n@@ -225,10 +226,7 @@ then\n \t\tpreserve_merges=t\n \telif test -f \"$merge_dir\"/interactive\n \tthen\n-\t\ttype=interactive\n \t\tinteractive_rebase=explicit\n-\telse\n-\t\ttype=merge\n \tfi\n \tstate_dir=\"$merge_dir\"\n fi\n@@ -469,6 +467,7 @@ then\n \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n fi\n \n+actually_interactive=\n if test -n \"$interactive_rebase\"\n then\n \tif test -z \"$preserve_merges\"\n@@ -477,11 +476,12 @@ then\n \telse\n \t\ttype=preserve-merges\n \tfi\n-\n+\tactually_interactive=t\n \tstate_dir=\"$merge_dir\"\n elif test -n \"$do_merge\"\n then\n-\ttype=merge\n+\tinteractive_rebase=implied\n+\ttype=interactive\n \tstate_dir=\"$merge_dir\"\n else\n \ttype=am\n@@ -493,21 +493,13 @@ then\n \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n fi\n \n-if test -n \"$git_am_opt\"; then\n-\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n-\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n-\tif test -n \"$interactive_rebase\"\n+incompatible_opts=$(echo \" $git_am_opt \" | \\\n+\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+if test -n \"$incompatible_opts\"\n+then\n+\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n \tthen\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n-\t\tfi\n-\tfi\n-\tif test -n \"$do_merge\"; then\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n-\t\tfi\n+\t\tdie \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n \tfi\n fi\n \n@@ -672,7 +664,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n # but this should be done only when upstream and onto are the same\n # and if this is not an interactive rebase.\n mb=$(git merge-base \"$onto\" \"$orig_head\")\n-if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n+if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n \t# linear history?\n \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n@@ -716,6 +708,19 @@ then\n \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n fi\n \n+if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n+then\n+\t# If the $onto is a proper descendant of the tip of the branch, then\n+\t# we just fast-forwarded.\n+\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n+\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n+\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n+\tgit update-ref ORIG_HEAD $orig_head\n+\tmove_to_original_branch\n+\tfinish_rebase\n+\texit 0\n+fi\n+\n test -n \"$interactive_rebase\" && run_specific_rebase\n \n # Detach HEAD and reset the tree\n@@ -725,16 +730,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n \n-# If the $onto is a proper descendant of the tip of the branch, then\n-# we just fast-forwarded.\n-if test \"$mb\" = \"$orig_head\"\n-then\n-\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n-\tmove_to_original_branch\n-\tfinish_rebase\n-\texit 0\n-fi\n-\n if test -n \"$rebase_root\"\n then\n \trevisions=\"$onto..$orig_head\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\ndeleted file mode 100644\nindex aa2f2f0872..0000000000\n--- a/git-rebase--merge.sh\n+++ /dev/null\n@@ -1,164 +0,0 @@\n-# This shell script fragment is sourced by git-rebase to implement\n-# its merge-based non-interactive mode that copes well with renamed\n-# files.\n-#\n-# Copyright (c) 2010 Junio C Hamano.\n-#\n-\n-prec=4\n-\n-read_state () {\n-\tonto_name=$(cat \"$state_dir\"/onto_name) &&\n-\tend=$(cat \"$state_dir\"/end) &&\n-\tmsgnum=$(cat \"$state_dir\"/msgnum)\n-}\n-\n-continue_merge () {\n-\ttest -d \"$state_dir\" || die \"$state_dir directory does not exist\"\n-\n-\tunmerged=$(git ls-files -u)\n-\tif test -n \"$unmerged\"\n-\tthen\n-\t\techo \"You still have unmerged paths in your index\"\n-\t\techo \"did you forget to use git add?\"\n-\t\tdie \"$resolvemsg\"\n-\tfi\n-\n-\tcmt=$(cat \"$state_dir/current\")\n-\tif ! git diff-index --quiet --ignore-submodules HEAD --\n-\tthen\n-\t\tif ! git commit ${gpg_sign_opt:+\"$gpg_sign_opt\"} $signoff $allow_empty_message \\\n-\t\t\t--no-verify -C \"$cmt\"\n-\t\tthen\n-\t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n-\t\t\techo \"directly, but instead do one of the following: \"\n-\t\t\tdie \"$resolvemsg\"\n-\t\tfi\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Committed: %0${prec}d \" $msgnum\n-\t\tfi\n-\t\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\telse\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Already applied: %0${prec}d \" $msgnum\n-\t\tfi\n-\tfi\n-\ttest -z \"$GIT_QUIET\" &&\n-\tGIT_PAGER='' git log --format=%s -1 \"$cmt\"\n-\n-\t# onto the next patch:\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-}\n-\n-call_merge () {\n-\tmsgnum=\"$1\"\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt\" > \"$state_dir/current\"\n-\tgit update-ref REBASE_HEAD \"$cmt\"\n-\thd=$(git rev-parse --verify HEAD)\n-\tcmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)\n-\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n-\teval GITHEAD_$hd='$onto_name'\n-\texport GITHEAD_$cmt GITHEAD_$hd\n-\tif test -n \"$GIT_QUIET\"\n-\tthen\n-\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n-\tfi\n-\ttest -z \"$strategy\" && strategy=recursive\n-\t# If cmt doesn't have a parent, don't include it as a base\n-\tbase=$(git rev-parse --verify --quiet $cmt^)\n-\teval 'git merge-$strategy' $strategy_opts $base ' -- \"$hd\" \"$cmt\"'\n-\trv=$?\n-\tcase \"$rv\" in\n-\t0)\n-\t\tunset GITHEAD_$cmt GITHEAD_$hd\n-\t\treturn\n-\t\t;;\n-\t1)\n-\t\tgit rerere $allow_rerere_autoupdate\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t2)\n-\t\techo \"Strategy: $strategy failed, try another\" 1>&2\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t*)\n-\t\tdie \"Unknown exit code ($rv) from command:\" \\\n-\t\t\t\"git merge-$strategy $cmt^ -- HEAD $cmt\"\n-\t\t;;\n-\tesac\n-}\n-\n-finish_rb_merge () {\n-\tmove_to_original_branch\n-\tif test -s \"$state_dir\"/rewritten\n-\tthen\n-\t\tgit notes copy --for-rewrite=rebase <\"$state_dir\"/rewritten\n-\t\thook=\"$(git rev-parse --git-path hooks/post-rewrite)\"\n-\t\ttest -x \"$hook\" && \"$hook\" rebase <\"$state_dir\"/rewritten\n-\tfi\n-\tsay All done.\n-}\n-\n-git_rebase__merge () {\n-\n-case \"$action\" in\n-continue)\n-\tread_state\n-\tcontinue_merge\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-skip)\n-\tread_state\n-\tgit rerere clear\n-\tmsgnum=$(($msgnum + 1))\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-show-current-patch)\n-\texec git show REBASE_HEAD --\n-\t;;\n-esac\n-\n-mkdir -p \"$state_dir\"\n-echo \"$onto_name\" > \"$state_dir/onto_name\"\n-write_basic_state\n-rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n-\n-msgnum=0\n-for cmt in $(git rev-list --reverse --no-merges \"$revisions\")\n-do\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n-done\n-\n-echo 1 >\"$state_dir/msgnum\"\n-echo $msgnum >\"$state_dir/end\"\n-\n-end=$msgnum\n-msgnum=1\n-\n-while test \"$msgnum\" -le \"$end\"\n-do\n-\tcall_merge \"$msgnum\"\n-\tcontinue_merge\n-done\n-\n-finish_rb_merge\n-\n-}\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex 0392e36d23..04d6c71899 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -17,14 +17,9 @@ test_expect_success 'setup' '\n \tgit tag start\n '\n \n-cat >expect <<\\EOF\n-Already applied: 0001 A\n-Already applied: 0002 B\n-Committed: 0003 Z\n-EOF\n-\n test_expect_success 'rebase -m' '\n \tgit rebase -m master >report &&\n+\t>expect &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex f355c6825a..49077200c5 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -53,41 +53,6 @@ create_expected_success_interactive () {\n \tEOF\n }\n \n-create_expected_success_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplied autostash.\n-\tEOF\n-}\n-\n create_expected_failure_am () {\n \tcat >expected <<-EOF\n \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n@@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n \tEOF\n }\n \n-create_expected_failure_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplying autostash resulted in conflicts.\n-\tYour changes are safe in the stash.\n-\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n-\tEOF\n-}\n-\n testrebase () {\n \ttype=$1\n \tdotest=$2\n@@ -177,6 +105,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type --autostash: check output\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_success_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\n@@ -274,6 +205,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_failure_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 99b2aac921..911ef49f70 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -111,7 +111,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n@@ -126,7 +126,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n@@ -141,7 +141,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n@@ -284,7 +284,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase success -p\n \n@@ -315,7 +315,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_run_rebase failure -p\n \ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 846f85c27e..cd505c0711 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -72,7 +72,7 @@ test_run_rebase () {\n }\n #TODO: make order consistent across all flavors of rebase\n test_run_rebase success 'e n o' ''\n-test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' -m\n test_run_rebase success 'n o e' -i\n \n test_run_rebase () {\n@@ -89,7 +89,7 @@ test_run_rebase () {\n }\n #TODO: make order consistent across all flavors of rebase\n test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_run_rebase () {\n@@ -106,7 +106,7 @@ test_run_rebase () {\n }\n #TODO: make order consistent across all flavors of rebase\n test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_expect_success \"rebase -p is no-op in non-linear history\" \"\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 9b2a274c71..145c61251d 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -120,6 +120,7 @@ test_expect_success 'git rebase -m --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 81a5179e28..5cadedb2a9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n '\n \n test_expect_success 'prompt - rebase merge' '\n-\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n+\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n \tgit checkout b2 &&\n \ttest_when_finished \"git checkout master\" &&\n \ttest_must_fail git rebase --merge b1 b2 &&\n-- \n2.19.1.858.g526e8fe740.dirty\n\n"},{"id":"362719","messageId":"20181108060158.27145-1-newren@gmail.com","threadId":"49781","inReplyTo":null,"subject":"[PATCH v2 0/2] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-08T06:01:56Z","receivedAt":"2018-11-08T06:02:16Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Now that the rewrite-interactive-rebases-in-C series have finally\nmerged to master, this series deletes git-rebase--merge.sh and\nreimplements the --merge behavior on top of the interactive machinery.\n\nDifferences since v1:\n  - Updated code to hook into builtin/rebase.C instead of git-rebase.sh\n\n(No range-diff provided, because it has been months since v1, and v1\nwas only RFC and was only discussed at a high level.)\n\nElijah Newren (2):\n  git-rebase, sequencer: extend --quiet option for the interactive\n    machinery\n  rebase: Implement --merge via git-rebase--interactive\n\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +---\n Makefile                          |   1 -\n builtin/rebase.c                  |  15 ++-\n git-legacy-rebase.sh              |  57 +++++------\n git-rebase--common.sh             |   2 +-\n git-rebase--merge.sh              | 164 ------------------------------\n sequencer.c                       |  23 +++--\n sequencer.h                       |   1 +\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t3425-rebase-topology-merges.sh |   6 +-\n t/t5407-post-rewrite-hook.sh      |   1 +\n t/t9903-bash-prompt.sh            |   2 +-\n 15 files changed, 67 insertions(+), 318 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\n-- \n2.19.1.858.g526e8fe740.dirty\n\n"},{"id":"362729","messageId":"CABPp-BHY8kB-hFd-MZ2-aC1CNQggXz9a+CcfkKiOiD=q9NLHwg@mail.gmail.com","threadId":"49781","inReplyTo":"20181108060158.27145-1-newren@gmail.com","subject":"Re: [PATCH v2 0/2] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-08T06:33:32Z","receivedAt":"2018-11-08T06:33:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Nov 7, 2018 at 10:02 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> Now that the rewrite-interactive-rebases-in-C series have finally\n> merged to master, this series deletes git-rebase--merge.sh and\n> reimplements the --merge behavior on top of the interactive machinery.\n>\n> Differences since v1:\n>   - Updated code to hook into builtin/rebase.C instead of git-rebase.sh\n>\n> (No range-diff provided, because it has been months since v1, and v1\n> was only RFC and was only discussed at a high level.)\n\nActually, that's not correct; it's been so long that I forgot.  Dscho\nand Phillip both reviewed it and I updated my series at the time with\ntheir suggestions, but didn't re-submit because it depended on so many\nother series and conflicted with the rebase-in-C work.  So other\ndifferences include the changes I made to address their feedback,\nbut...even if I dug up the old v1 and created a range-diff against it\nI'm not so sure it'd be helpful.  If anyone thinks it would be, holler\nand I'll generate it.\n\nOriginal series here:\nhttps://public-inbox.org/git/20180607171344.23331-1-newren@gmail.com/\n"},{"id":"363040","messageId":"nycvar.QRO.7.76.6.1811121610350.39@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181108060158.27145-2-newren@gmail.com","subject":"Re: [PATCH v2 1/2] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-12T15:11:44Z","receivedAt":"2018-11-12T15:11:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Wed, 7 Nov 2018, Elijah Newren wrote:\n\n> While 'quiet' and 'interactive' may sound like antonyms, the interactive\n> machinery actually has logic that implements several\n> interactive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\n> which won't pop up an editor.  The rewrite of interactive rebase in C\n> added a quiet option, though it only turns stats off.  Since we want to\n> make the interactive machinery also take over for git-rebase--merge, it\n> should fully implement the --quiet option.\n> \n> git-rebase--interactive was already somewhat quieter than\n> git-rebase--merge and git-rebase--am, possibly because cherry-pick has\n> just traditionally been quieter.  As such, we only drop a few\n> informational messages -- \"Rebasing (n/m)\" and \"Succesfully rebased...\"\n\nMakes sense.\n\n> Also, for simplicity, remove the differences in how quiet and verbose\n> options were recorded.  Having one be signalled by the presence of a\n> \"verbose\" file in the state_dir, while the other was signalled by the\n> contents of a \"quiet\" file was just weirdly inconsistent.  (This\n> inconsistency pre-dated the rewrite into C.)  Make them consistent by\n> having them both key off the presence of the file.\n\nI am slightly concerned that some creative power user could have written\nscripts that rely on this behavior.\n\nBut only *slightly* concerned.\n\nThe patch looks correct.\n\nCiao,\nDscho\n\n> \n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n>  builtin/rebase.c      |  5 +----\n>  git-legacy-rebase.sh  |  2 +-\n>  git-rebase--common.sh |  2 +-\n>  sequencer.c           | 23 +++++++++++++----------\n>  sequencer.h           |  1 +\n>  5 files changed, 17 insertions(+), 16 deletions(-)\n> \n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 0ee06aa363..be004406a6 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -181,10 +181,7 @@ static int read_basic_state(struct rebase_options *opts)\n>  \tif (get_oid(buf.buf, &opts->orig_head))\n>  \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n>  \n> -\tstrbuf_reset(&buf);\n> -\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n> -\t\treturn -1;\n> -\tif (buf.len)\n> +\tif (file_exists(state_dir_path(\"quiet\", opts)))\n>  \t\topts->flags &= ~REBASE_NO_QUIET;\n>  \telse\n>  \t\topts->flags |= REBASE_NO_QUIET;\n> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n> index 75a08b2683..da27bfca5a 100755\n> --- a/git-legacy-rebase.sh\n> +++ b/git-legacy-rebase.sh\n> @@ -113,7 +113,7 @@ read_basic_state () {\n>  \telse\n>  \t\torig_head=$(cat \"$state_dir\"/head)\n>  \tfi &&\n> -\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n> +\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n>  \ttest -f \"$state_dir\"/verbose && verbose=t\n>  \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n>  \ttest -f \"$state_dir\"/strategy_opts &&\n> diff --git a/git-rebase--common.sh b/git-rebase--common.sh\n> index 7e39d22871..dc18c682fa 100644\n> --- a/git-rebase--common.sh\n> +++ b/git-rebase--common.sh\n> @@ -10,7 +10,7 @@ write_basic_state () {\n>  \techo \"$head_name\" > \"$state_dir\"/head-name &&\n>  \techo \"$onto\" > \"$state_dir\"/onto &&\n>  \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n> -\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n> +\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n>  \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n>  \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n>  \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\n> diff --git a/sequencer.c b/sequencer.c\n> index 9e1ab3a2a7..bd8337dbf1 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n>  static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n>  static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n>  static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n> +static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n>  static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n>  static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n>  static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n> @@ -157,7 +158,6 @@ 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> -static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n>  \n>  static int git_sequencer_config(const char *k, const char *v, void *cb)\n>  {\n> @@ -2307,6 +2307,9 @@ static int read_populate_opts(struct replay_opts *opts)\n>  \t\tif (file_exists(rebase_path_verbose()))\n>  \t\t\topts->verbose = 1;\n>  \n> +\t\tif (file_exists(rebase_path_quiet()))\n> +\t\t\topts->quiet = 1;\n> +\n>  \t\tif (file_exists(rebase_path_signoff())) {\n>  \t\t\topts->allow_ff = 0;\n>  \t\t\topts->signoff = 1;\n> @@ -2374,9 +2377,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n>  \n>  \tif (quiet)\n>  \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n> -\telse\n> -\t\twrite_file(rebase_path_quiet(), \"\\n\");\n> -\n>  \tif (opts->verbose)\n>  \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n>  \tif (opts->strategy)\n> @@ -3450,10 +3450,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n>  \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n>  \t\t\t\t\tfclose(f);\n>  \t\t\t\t}\n> -\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n> -\t\t\t\t\ttodo_list->done_nr,\n> -\t\t\t\t\ttodo_list->total_nr,\n> -\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n> +\t\t\t\tif (!opts->quiet)\n> +\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n> +\t\t\t\t\t\ttodo_list->done_nr,\n> +\t\t\t\t\t\ttodo_list->total_nr,\n> +\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n>  \t\t\t}\n>  \t\t\tunlink(rebase_path_message());\n>  \t\t\tunlink(rebase_path_author_script());\n> @@ -3684,8 +3685,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n>  \t\t}\n>  \t\tapply_autostash(opts);\n>  \n> -\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n> -\t\t\thead_ref.buf);\n> +\t\tif (!opts->quiet)\n> +\t\t\tfprintf(stderr,\n> +\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n> +\t\t\t\thead_ref.buf);\n>  \n>  \t\tstrbuf_release(&buf);\n>  \t\tstrbuf_release(&head_ref);\n> diff --git a/sequencer.h b/sequencer.h\n> index 660cff5050..45fd977bef 100644\n> --- a/sequencer.h\n> +++ b/sequencer.h\n> @@ -39,6 +39,7 @@ struct replay_opts {\n>  \tint allow_empty_message;\n>  \tint keep_redundant_commits;\n>  \tint verbose;\n> +\tint quiet;\n>  \n>  \tint mainline;\n>  \n> -- \n> 2.19.1.858.g526e8fe740.dirty\n> \n> \n"},{"id":"363058","messageId":"nycvar.QRO.7.76.6.1811121614190.39@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181108060158.27145-3-newren@gmail.com","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-12T16:21:05Z","receivedAt":"2018-11-12T16:21:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Wed, 7 Nov 2018, Elijah Newren wrote:\n\n> Interactive rebases are implemented in terms of cherry-pick rather than\n> the merge-recursive builtin, but cherry-pick also calls into the recursive\n> merge machinery by default and can accept special merge strategies and/or\n> special strategy options.  As such, there really is not any need for\n> having both git-rebase--merge and git-rebase--interactive anymore.\n> \n> Delete git-rebase--merge.sh and have the --merge option be implemented\n> by the now built-in interactive machinery.\n\nOkay.\n\n> Note that this change fixes a few known test failures (see t3421).\n\nNice!\n\n> testcase modification notes:\n>   t3406: --interactive and --merge had slightly different progress output\n>          while running; adjust a test to match\n>   t3420: these test precise output while running, but rebase--am,\n>          rebase--merge, and rebase--interactive all were built on very\n>          different commands (am, merge-recursive, cherry-pick), so the\n>          tests expected different output for each type.  Now we expect\n>          --merge and --interactive to have the same output.\n>   t3421: --interactive fixes some bugs in --merge!  Wahoo!\n>   t3425: topology linearization was inconsistent across flavors of rebase,\n>          as already noted in a TODO comment in the testcase.  This was not\n>          considered a bug before, so getting a different linearization due\n>          to switching out backends should not be considered a bug now.\n\nIdeally, the test would be fixed, then. If it fails for other reasons than\na real regression, it is not a very good regression test, is it.\n\n>   t5407: different rebase types varied slightly in how many times checkout\n>          or commit or equivalents were called based on a quick comparison\n>          of this tests and previous ones which covered different rebase\n>          flavors.  I think this is just attributable to this difference.\n\nThis concerns me.\n\nIn bigger repositories (no, I am not talking about Linux kernel sized\nones, I consider those small-ish) there are a ton of files, and checkout\nand commit (and even more so reset) sadly do not have a runtime complexity\ngrowing with the number of modified files, but with the number of tracked\nfiles (and some commands even with the number of worktree files).\n\nSo a larger number of commit/checkout operations makes me expect\nperformance regressions.\n\nIn this light, could you elaborate a bit on the differences you see\nbetween rebase -i and rebase -m?\n\n>   t9903: --merge uses the interactive backend so the prompt expected is\n>          now REBASE-i.\n\nWe should be able to make that test pass, still, by writing out a special\nfile (e.g. $state_dir/opt_m) and testing for that. Users are oddly upset\nwhen their expectations are broken... (and I actually agree with them.)\n\n> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> index 3407d835bd..35084f5681 100644\n> --- a/Documentation/git-rebase.txt\n> +++ b/Documentation/git-rebase.txt\n> @@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n>  INCOMPATIBLE OPTIONS\n>  --------------------\n>  \n> -git-rebase has many flags that are incompatible with each other,\n> -predominantly due to the fact that it has three different underlying\n> -implementations:\n> -\n> - * one based on linkgit:git-am[1] (the default)\n> - * one based on git-merge-recursive (merge backend)\n> - * one based on linkgit:git-cherry-pick[1] (interactive backend)\n> -\n\nCould we retain this part, with `s/three/two/` and `/git-merge/d`? *Maybe*\n`s/interactive backend/interactive\\/merge backend/`\n\n> -Flags only understood by the am backend:\n> +The following options:\n>  \n>   * --committer-date-is-author-date\n>   * --ignore-date\n> @@ -520,15 +512,12 @@ Flags only understood by the am backend:\n>   * --ignore-whitespace\n>   * -C\n>  \n> -Flags understood by both merge and interactive backends:\n> +are incompatible with the following options:\n>  \n>   * --merge\n>   * --strategy\n>   * --strategy-option\n>   * --allow-empty-message\n> -\n> -Flags only understood by the interactive backend:\n> -\n>   * --[no-]autosquash\n>   * --rebase-merges\n>   * --preserve-merges\n> @@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n>   * --edit-todo\n>   * --root when used in combination with --onto\n>  \n> -Other incompatible flag pairs:\n> +In addition, the following pairs of options are incompatible:\n>  \n>   * --preserve-merges and --interactive\n>   * --preserve-merges and --signoff\n\nThe rest of the diff is funny to read, but the post image makes a lot of\nsense.\n\n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index be004406a6..d55bbb9eb9 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -118,7 +118,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n>  \tcase REBASE_PRESERVE_MERGES:\n>  \t\tbreak;\n>  \tcase REBASE_MERGE:\n> -\t\t/* we silently *upgrade* --merge to --interactive if needed */\n> +\t\t/* we now implement --merge via --interactive */\n>  \tdefault:\n>  \t\topts->type = REBASE_INTERACTIVE; /* implied */\n>  \t\tbreak;\n> @@ -475,10 +475,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n>  \t\tbackend = \"git-rebase--am\";\n>  \t\tbackend_func = \"git_rebase__am\";\n>  \t\tbreak;\n> -\tcase REBASE_MERGE:\n> -\t\tbackend = \"git-rebase--merge\";\n> -\t\tbackend_func = \"git_rebase__merge\";\n> -\t\tbreak;\n>  \tcase REBASE_PRESERVE_MERGES:\n>  \t\tbackend = \"git-rebase--preserve-merges\";\n>  \t\tbackend_func = \"git_rebase__preserve_merges\";\n> @@ -1156,6 +1152,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>  \t\t}\n>  \t}\n>  \n> +\tif (options.type == REBASE_MERGE) {\n> +\t\timply_interactive(&options, \"--merge\");\n> +\t}\n> +\n>  \tif (options.root && !options.onto_name)\n>  \t\timply_interactive(&options, \"--root without --onto\");\n>  \n\nOkay, this makes sense.\n\n> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n> index da27bfca5a..4abcceed06 100755\n> --- a/git-legacy-rebase.sh\n> +++ b/git-legacy-rebase.sh\n> @@ -218,6 +218,7 @@ then\n>  \tstate_dir=\"$apply_dir\"\n>  elif test -d \"$merge_dir\"\n>  then\n> +\ttype=interactive\n>  \tif test -d \"$merge_dir\"/rewritten\n>  \tthen\n>  \t\ttype=preserve-merges\n> @@ -225,10 +226,7 @@ then\n>  \t\tpreserve_merges=t\n>  \telif test -f \"$merge_dir\"/interactive\n>  \tthen\n> -\t\ttype=interactive\n>  \t\tinteractive_rebase=explicit\n> -\telse\n> -\t\ttype=merge\n>  \tfi\n>  \tstate_dir=\"$merge_dir\"\n>  fi\n> @@ -469,6 +467,7 @@ then\n>  \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n>  fi\n>  \n> +actually_interactive=\n>  if test -n \"$interactive_rebase\"\n>  then\n>  \tif test -z \"$preserve_merges\"\n> @@ -477,11 +476,12 @@ then\n>  \telse\n>  \t\ttype=preserve-merges\n>  \tfi\n> -\n> +\tactually_interactive=t\n>  \tstate_dir=\"$merge_dir\"\n>  elif test -n \"$do_merge\"\n>  then\n> -\ttype=merge\n> +\tinteractive_rebase=implied\n> +\ttype=interactive\n>  \tstate_dir=\"$merge_dir\"\n>  else\n>  \ttype=am\n> @@ -493,21 +493,13 @@ then\n>  \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n>  fi\n>  \n> -if test -n \"$git_am_opt\"; then\n> -\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n> -\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> -\tif test -n \"$interactive_rebase\"\n> +incompatible_opts=$(echo \" $git_am_opt \" | \\\n> +\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n\nWhy are we no longer guarding this behind the condition that the user\nspecified *any* option intended for the `am` backend?\n\n> +if test -n \"$incompatible_opts\"\n> +then\n> +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n>  \tthen\n> -\t\tif test -n \"$incompatible_opts\"\n> -\t\tthen\n> -\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> -\t\tfi\n> -\tfi\n> -\tif test -n \"$do_merge\"; then\n> -\t\tif test -n \"$incompatible_opts\"\n> -\t\tthen\n> -\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> -\t\tfi\n> +\t\tdie \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n>  \tfi\n>  fi\n>  \n\nThe rest of this hunk makes sense.\n\n> @@ -672,7 +664,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n>  # but this should be done only when upstream and onto are the same\n>  # and if this is not an interactive rebase.\n>  mb=$(git merge-base \"$onto\" \"$orig_head\")\n> -if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n> +if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n>  \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n>  \t# linear history?\n>  \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n> @@ -716,6 +708,19 @@ then\n>  \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n>  fi\n>  \n> +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n> +then\n> +\t# If the $onto is a proper descendant of the tip of the branch, then\n> +\t# we just fast-forwarded.\n\nThis comment is misleading if it comes before, rather than after, the\nactual `checkout -q` command.\n\n> +\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> +\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n> +\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n> +\tgit update-ref ORIG_HEAD $orig_head\n> +\tmove_to_original_branch\n> +\tfinish_rebase\n> +\texit 0\n> +fi\n> +\n>  test -n \"$interactive_rebase\" && run_specific_rebase\n>  \n>  # Detach HEAD and reset the tree\n> @@ -725,16 +730,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n>  \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n>  git update-ref ORIG_HEAD $orig_head\n\nIt is a pity that this hunk header hides the lines that you copied into\nthe following conditional before moving it before the \"if interactive, run\nit\" line:\n\n>  \n> -# If the $onto is a proper descendant of the tip of the branch, then\n> -# we just fast-forwarded.\n> -if test \"$mb\" = \"$orig_head\"\n> -then\n> -\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> -\tmove_to_original_branch\n> -\tfinish_rebase\n> -\texit 0\n> -fi\n> -\n>  if test -n \"$rebase_root\"\n>  then\n>  \trevisions=\"$onto..$orig_head\"\n\nWhat you did is correct, if duplicating code, and definitely the easiest\nway to do it. Just move the comment, and we're good here.\n\n> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n> deleted file mode 100644\n> [... snip ...]\n\nNice. Really nice!\n\n> diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\n> index 0392e36d23..04d6c71899 100755\n> --- a/t/t3406-rebase-message.sh\n> +++ b/t/t3406-rebase-message.sh\n> @@ -17,14 +17,9 @@ test_expect_success 'setup' '\n>  \tgit tag start\n>  '\n>  \n> -cat >expect <<\\EOF\n> -Already applied: 0001 A\n> -Already applied: 0002 B\n> -Committed: 0003 Z\n> -EOF\n> -\n\nAs I had mentioned in the previous round: I think we can retain these\nmessages for the `--merge` mode. And I think we should: users of --merge\nhave most likely become to expect them.\n\nThe most elegant way would probably be by adding code to the sequencer\nthat outputs these lines if in \"merge\" mode (and add a flag to say that we\n*are* in \"merge\" mode).\n\nTo that end, the `make_script()` function would not generate `# pick` but\n`drop` lines, I think, so that the sequencer can see those and print the\n`Already applied: <message>` lines. And a successful `TODO_PICK` would\nwrite out `Committed: <message>`.\n\n>  test_expect_success 'rebase -m' '\n>  \tgit rebase -m master >report &&\n> +\t>expect &&\n>  \tsed -n -e \"/^Already applied: /p\" \\\n>  \t\t-e \"/^Committed: /p\" report >actual &&\n>  \ttest_cmp expect actual\n> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n> index f355c6825a..49077200c5 100755\n> --- a/t/t3420-rebase-autostash.sh\n> +++ b/t/t3420-rebase-autostash.sh\n> @@ -53,41 +53,6 @@ create_expected_success_interactive () {\n>  \tEOF\n>  }\n>  \n> -create_expected_success_merge () {\n> -\tcat >expected <<-EOF\n> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n> -\tFirst, rewinding head to replay your work on top of it...\n> -\tMerging unrelated-onto-branch with HEAD~1\n> -\tMerging:\n> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n> -\t$(git rev-parse --short feature-branch^) second commit\n> -\tfound 1 common ancestor:\n> -\t$(git rev-parse --short feature-branch~2) initial commit\n> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> -\t Author: A U Thor <author@example.com>\n> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n> -\t 2 files changed, 2 insertions(+)\n> -\t create mode 100644 file1\n> -\t create mode 100644 file2\n> -\tCommitted: 0001 second commit\n> -\tMerging unrelated-onto-branch with HEAD~0\n> -\tMerging:\n> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n> -\t$(git rev-parse --short feature-branch) third commit\n> -\tfound 1 common ancestor:\n> -\t$(git rev-parse --short feature-branch~1) second commit\n> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> -\t Author: A U Thor <author@example.com>\n> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n> -\t 1 file changed, 1 insertion(+)\n> -\t create mode 100644 file3\n> -\tCommitted: 0002 third commit\n> -\tAll done.\n> -\tApplied autostash.\n> -\tEOF\n> -}\n> -\n>  create_expected_failure_am () {\n>  \tcat >expected <<-EOF\n>  \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> @@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n>  \tEOF\n>  }\n>  \n> -create_expected_failure_merge () {\n> -\tcat >expected <<-EOF\n> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n> -\tFirst, rewinding head to replay your work on top of it...\n> -\tMerging unrelated-onto-branch with HEAD~1\n> -\tMerging:\n> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n> -\t$(git rev-parse --short feature-branch^) second commit\n> -\tfound 1 common ancestor:\n> -\t$(git rev-parse --short feature-branch~2) initial commit\n> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> -\t Author: A U Thor <author@example.com>\n> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n> -\t 2 files changed, 2 insertions(+)\n> -\t create mode 100644 file1\n> -\t create mode 100644 file2\n> -\tCommitted: 0001 second commit\n> -\tMerging unrelated-onto-branch with HEAD~0\n> -\tMerging:\n> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n> -\t$(git rev-parse --short feature-branch) third commit\n> -\tfound 1 common ancestor:\n> -\t$(git rev-parse --short feature-branch~1) second commit\n> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> -\t Author: A U Thor <author@example.com>\n> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n> -\t 1 file changed, 1 insertion(+)\n> -\t create mode 100644 file3\n> -\tCommitted: 0002 third commit\n> -\tAll done.\n> -\tApplying autostash resulted in conflicts.\n> -\tYour changes are safe in the stash.\n> -\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n> -\tEOF\n> -}\n> -\n>  testrebase () {\n>  \ttype=$1\n>  \tdotest=$2\n> @@ -177,6 +105,9 @@ testrebase () {\n>  \ttest_expect_success \"rebase$type --autostash: check output\" '\n>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n> +\t\tif test ${suffix} = \"merge\"; then\n> +\t\t\tsuffix=interactive\n> +\t\tfi &&\n>  \t\tcreate_expected_success_$suffix &&\n>  \t\ttest_i18ncmp expected actual\n>  \t'\n> @@ -274,6 +205,9 @@ testrebase () {\n>  \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n> +\t\tif test ${suffix} = \"merge\"; then\n> +\t\t\tsuffix=interactive\n> +\t\tfi &&\n>  \t\tcreate_expected_failure_$suffix &&\n>  \t\ttest_i18ncmp expected actual\n>  \t'\n\nAs I stated earlier, I am uncomfortable with this solution. We change\nbehavior rather noticeably, and the regression test tells us the same. We\nneed to either try to deprecate `git rebase --merge`, or we need to at\nleast attempt to recreate the old behavior with the sequencer.\n\n> diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\n> index 99b2aac921..911ef49f70 100755\n> --- a/t/t3421-rebase-topology-linear.sh\n> +++ b/t/t3421-rebase-topology-linear.sh\n> @@ -111,7 +111,7 @@ test_run_rebase () {\n>  \t\"\n>  }\n>  test_run_rebase success ''\n> -test_run_rebase failure -m\n> +test_run_rebase success -m\n>  test_run_rebase success -i\n>  test_run_rebase success -p\n>  \n> @@ -126,7 +126,7 @@ test_run_rebase () {\n>  \t\"\n>  }\n>  test_run_rebase success ''\n> -test_run_rebase failure -m\n> +test_run_rebase success -m\n>  test_run_rebase success -i\n>  test_run_rebase success -p\n>  \n> @@ -141,7 +141,7 @@ test_run_rebase () {\n>  \t\"\n>  }\n>  test_run_rebase success ''\n> -test_run_rebase failure -m\n> +test_run_rebase success -m\n>  test_run_rebase success -i\n>  test_run_rebase success -p\n>  \n> @@ -284,7 +284,7 @@ test_run_rebase () {\n>  \t\"\n>  }\n>  test_run_rebase success ''\n> -test_run_rebase failure -m\n> +test_run_rebase success -m\n>  test_run_rebase success -i\n>  test_run_rebase success -p\n>  \n> @@ -315,7 +315,7 @@ test_run_rebase () {\n>  \t\"\n>  }\n>  test_run_rebase success ''\n> -test_run_rebase failure -m\n> +test_run_rebase success -m\n>  test_run_rebase success -i\n>  test_run_rebase failure -p\n>  \n\nNice.\n\n> diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n> index 846f85c27e..cd505c0711 100755\n> --- a/t/t3425-rebase-topology-merges.sh\n> +++ b/t/t3425-rebase-topology-merges.sh\n> @@ -72,7 +72,7 @@ test_run_rebase () {\n>  }\n>  #TODO: make order consistent across all flavors of rebase\n>  test_run_rebase success 'e n o' ''\n> -test_run_rebase success 'e n o' -m\n> +test_run_rebase success 'n o e' -m\n>  test_run_rebase success 'n o e' -i\n>  \n>  test_run_rebase () {\n> @@ -89,7 +89,7 @@ test_run_rebase () {\n>  }\n>  #TODO: make order consistent across all flavors of rebase\n>  test_run_rebase success 'd e n o' ''\n> -test_run_rebase success 'd e n o' -m\n> +test_run_rebase success 'd n o e' -m\n>  test_run_rebase success 'd n o e' -i\n>  \n>  test_run_rebase () {\n> @@ -106,7 +106,7 @@ test_run_rebase () {\n>  }\n>  #TODO: make order consistent across all flavors of rebase\n>  test_run_rebase success 'd e n o' ''\n> -test_run_rebase success 'd e n o' -m\n> +test_run_rebase success 'd n o e' -m\n>  test_run_rebase success 'd n o e' -i\n>  \n>  test_expect_success \"rebase -p is no-op in non-linear history\" \"\n\nThis is a bit unfortunate. I wonder if we could do something like this, to\nretain the current behavior:\n\n-- snip --\ndiff --git a/sequencer.c b/sequencer.c\nindex 9e1ab3a2a7..5018957e49 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -4394,7 +4394,8 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,\n \trevs.reverse = 1;\n \trevs.right_only = 1;\n \trevs.sort_order = REV_SORT_IN_GRAPH_ORDER;\n-\trevs.topo_order = 1;\n+\tif (!(flags & TODO_LIST_NO_TOPO_ORDER))\n+\t\trevs.topo_order = 1;\n \n \trevs.pretty_given = 1;\n \tgit_config_get_string(\"rebase.instructionFormat\", &format);\n-- snap -\n\n(and then pass TODO_LIST_NO_TOPO_ORDER if in \"merge\" mode)?\n\n> diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\n> index 9b2a274c71..145c61251d 100755\n> --- a/t/t5407-post-rewrite-hook.sh\n> +++ b/t/t5407-post-rewrite-hook.sh\n> @@ -120,6 +120,7 @@ test_expect_success 'git rebase -m --skip' '\n>  \tgit rebase --continue &&\n>  \techo rebase >expected.args &&\n>  \tcat >expected.data <<-EOF &&\n> +\t$(git rev-parse C) $(git rev-parse HEAD^)\n>  \t$(git rev-parse D) $(git rev-parse HEAD)\n>  \tEOF\n>  \tverify_hook_input\n\nThis suggests to me that we call `commit` too many times. I think we\nreally need to address this without changing the test. This is a change in\nbehavior.\n\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index 81a5179e28..5cadedb2a9 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n>  '\n>  \n>  test_expect_success 'prompt - rebase merge' '\n> -\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n> +\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n\nAs I said, this should be easily addressed by having a tell-tale in\n$state_dir/. Come to think of it, we must have had one, right? Let's see\nhow the bash-prompt does it.\n\n*clicketyclick*\n\nAh, it is the *absence* of the `interactive` file... Which makes me wonder\nwhether we should not simply retain that behavior for `git rebase\n--merge`?\n\n>  \tgit checkout b2 &&\n>  \ttest_when_finished \"git checkout master\" &&\n>  \ttest_must_fail git rebase --merge b1 b2 &&\n> -- \n> 2.19.1.858.g526e8fe740.dirty\n> \n> \n\nThank you for this pleasant read. I think there is still quite a bit of\nwork to do, but you already did most of it.\n\nOut of curiosity, do you have a public repository with these patches in a\nbranch? (I might have an hour to play with it tonight...)\n\nThanks!\nDscho\n"},{"id":"363066","messageId":"f0231c21-8727-94cb-96aa-13ebfb5b7283@talktalk.net","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1811121614190.39@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2018-11-12T18:21:12Z","receivedAt":"2018-11-12T18:21:19Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Elijah\n\nIt's good to see these patches progressing, I've just got a couple of\ncomments related to Johannes' points below\n\nOn 12/11/2018 16:21, Johannes Schindelin wrote:\n> Hi Elijah,\n> \n> On Wed, 7 Nov 2018, Elijah Newren wrote:\n> \n>> Interactive rebases are implemented in terms of cherry-pick rather than\n>> the merge-recursive builtin, but cherry-pick also calls into the recursive\n>> merge machinery by default and can accept special merge strategies and/or\n>> special strategy options.  As such, there really is not any need for\n>> having both git-rebase--merge and git-rebase--interactive anymore.\n>>\n>> Delete git-rebase--merge.sh and have the --merge option be implemented\n>> by the now built-in interactive machinery.\n> \n> Okay.\n> \n>> Note that this change fixes a few known test failures (see t3421).\n> \n> Nice!\n> \n>> testcase modification notes:\n>>   t3406: --interactive and --merge had slightly different progress output\n>>          while running; adjust a test to match\n>>   t3420: these test precise output while running, but rebase--am,\n>>          rebase--merge, and rebase--interactive all were built on very\n>>          different commands (am, merge-recursive, cherry-pick), so the\n>>          tests expected different output for each type.  Now we expect\n>>          --merge and --interactive to have the same output.\n>>   t3421: --interactive fixes some bugs in --merge!  Wahoo!\n>>   t3425: topology linearization was inconsistent across flavors of rebase,\n>>          as already noted in a TODO comment in the testcase.  This was not\n>>          considered a bug before, so getting a different linearization due\n>>          to switching out backends should not be considered a bug now.\n> \n> Ideally, the test would be fixed, then. If it fails for other reasons than\n> a real regression, it is not a very good regression test, is it.\n> \n>>   t5407: different rebase types varied slightly in how many times checkout\n>>          or commit or equivalents were called based on a quick comparison\n>>          of this tests and previous ones which covered different rebase\n>>          flavors.  I think this is just attributable to this difference.\n> \n> This concerns me.\n> \n> In bigger repositories (no, I am not talking about Linux kernel sized\n> ones, I consider those small-ish) there are a ton of files, and checkout\n> and commit (and even more so reset) sadly do not have a runtime complexity\n> growing with the number of modified files, but with the number of tracked\n> files (and some commands even with the number of worktree files).\n> \n> So a larger number of commit/checkout operations makes me expect\n> performance regressions.\n> \n> In this light, could you elaborate a bit on the differences you see\n> between rebase -i and rebase -m?\n> \n>>   t9903: --merge uses the interactive backend so the prompt expected is\n>>          now REBASE-i.\n> \n> We should be able to make that test pass, still, by writing out a special\n> file (e.g. $state_dir/opt_m) and testing for that. Users are oddly upset\n> when their expectations are broken... (and I actually agree with them.)\n> \n>> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n>> index 3407d835bd..35084f5681 100644\n>> --- a/Documentation/git-rebase.txt\n>> +++ b/Documentation/git-rebase.txt\n>> @@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n>>  INCOMPATIBLE OPTIONS\n>>  --------------------\n>>  \n>> -git-rebase has many flags that are incompatible with each other,\n>> -predominantly due to the fact that it has three different underlying\n>> -implementations:\n>> -\n>> - * one based on linkgit:git-am[1] (the default)\n>> - * one based on git-merge-recursive (merge backend)\n>> - * one based on linkgit:git-cherry-pick[1] (interactive backend)\n>> -\n> \n> Could we retain this part, with `s/three/two/` and `/git-merge/d`? *Maybe*\n> `s/interactive backend/interactive\\/merge backend/`\n\nI was hoping we could get rid of that, I'm not sure how useful it is to\nusers.\n\n> \n>> -Flags only understood by the am backend:\n>> +The following options:\n>>  \n>>   * --committer-date-is-author-date\n>>   * --ignore-date\n>> @@ -520,15 +512,12 @@ Flags only understood by the am backend:\n>>   * --ignore-whitespace\n>>   * -C\n>>  \n>> -Flags understood by both merge and interactive backends:\n>> +are incompatible with the following options:\n>>  \n>>   * --merge\n>>   * --strategy\n>>   * --strategy-option\n>>   * --allow-empty-message\n>> -\n>> -Flags only understood by the interactive backend:\n>> -\n\nIt's nice to see this being simplified\n\n>>   * --[no-]autosquash\n>>   * --rebase-merges\n>>   * --preserve-merges\n>> @@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n>>   * --edit-todo\n>>   * --root when used in combination with --onto\n>>  \n>> -Other incompatible flag pairs:\n>> +In addition, the following pairs of options are incompatible:\n>>  \n>>   * --preserve-merges and --interactive\n>>   * --preserve-merges and --signoff\n> \n> The rest of the diff is funny to read, but the post image makes a lot of\n> sense.\n> \n>> diff --git a/builtin/rebase.c b/builtin/rebase.c\n>> index be004406a6..d55bbb9eb9 100644\n>> --- a/builtin/rebase.c\n>> +++ b/builtin/rebase.c\n>> @@ -118,7 +118,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n>>  \tcase REBASE_PRESERVE_MERGES:\n>>  \t\tbreak;\n>>  \tcase REBASE_MERGE:\n>> -\t\t/* we silently *upgrade* --merge to --interactive if needed */\n>> +\t\t/* we now implement --merge via --interactive */\n>>  \tdefault:\n>>  \t\topts->type = REBASE_INTERACTIVE; /* implied */\n>>  \t\tbreak;\n>> @@ -475,10 +475,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n>>  \t\tbackend = \"git-rebase--am\";\n>>  \t\tbackend_func = \"git_rebase__am\";\n>>  \t\tbreak;\n>> -\tcase REBASE_MERGE:\n>> -\t\tbackend = \"git-rebase--merge\";\n>> -\t\tbackend_func = \"git_rebase__merge\";\n>> -\t\tbreak;\n>>  \tcase REBASE_PRESERVE_MERGES:\n>>  \t\tbackend = \"git-rebase--preserve-merges\";\n>>  \t\tbackend_func = \"git_rebase__preserve_merges\";\n>> @@ -1156,6 +1152,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>>  \t\t}\n>>  \t}\n>>  \n>> +\tif (options.type == REBASE_MERGE) {\n>> +\t\timply_interactive(&options, \"--merge\");\n>> +\t}\n>> +\n>>  \tif (options.root && !options.onto_name)\n>>  \t\timply_interactive(&options, \"--root without --onto\");\n>>  \n> \n> Okay, this makes sense.\n> \n>> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n>> index da27bfca5a..4abcceed06 100755\n>> --- a/git-legacy-rebase.sh\n>> +++ b/git-legacy-rebase.sh\n>> @@ -218,6 +218,7 @@ then\n>>  \tstate_dir=\"$apply_dir\"\n>>  elif test -d \"$merge_dir\"\n>>  then\n>> +\ttype=interactive\n>>  \tif test -d \"$merge_dir\"/rewritten\n>>  \tthen\n>>  \t\ttype=preserve-merges\n>> @@ -225,10 +226,7 @@ then\n>>  \t\tpreserve_merges=t\n>>  \telif test -f \"$merge_dir\"/interactive\n>>  \tthen\n>> -\t\ttype=interactive\n>>  \t\tinteractive_rebase=explicit\n>> -\telse\n>> -\t\ttype=merge\n>>  \tfi\n>>  \tstate_dir=\"$merge_dir\"\n>>  fi\n>> @@ -469,6 +467,7 @@ then\n>>  \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n>>  fi\n>>  \n>> +actually_interactive=\n>>  if test -n \"$interactive_rebase\"\n>>  then\n>>  \tif test -z \"$preserve_merges\"\n>> @@ -477,11 +476,12 @@ then\n>>  \telse\n>>  \t\ttype=preserve-merges\n>>  \tfi\n>> -\n>> +\tactually_interactive=t\n>>  \tstate_dir=\"$merge_dir\"\n>>  elif test -n \"$do_merge\"\n>>  then\n>> -\ttype=merge\n>> +\tinteractive_rebase=implied\n>> +\ttype=interactive\n>>  \tstate_dir=\"$merge_dir\"\n>>  else\n>>  \ttype=am\n>> @@ -493,21 +493,13 @@ then\n>>  \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n>>  fi\n>>  \n>> -if test -n \"$git_am_opt\"; then\n>> -\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n>> -\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n>> -\tif test -n \"$interactive_rebase\"\n>> +incompatible_opts=$(echo \" $git_am_opt \" | \\\n>> +\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> \n> Why are we no longer guarding this behind the condition that the user\n> specified *any* option intended for the `am` backend?\n\nI was confused by this as well, what if the user asks for 'rebase\n--exec=<cmd> --ignore-whitespace'?\n\n> \n>> +if test -n \"$incompatible_opts\"\n>> +then\n>> +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n>>  \tthen\n>> -\t\tif test -n \"$incompatible_opts\"\n>> -\t\tthen\n>> -\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n>> -\t\tfi\n>> -\tfi\n>> -\tif test -n \"$do_merge\"; then\n>> -\t\tif test -n \"$incompatible_opts\"\n>> -\t\tthen\n>> -\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n>> -\t\tfi\n>> +\t\tdie \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n>>  \tfi\n>>  fi\n>>  \n\nIf you want to change the error message here, I think you need to change\nthe corresponding message in builtin/rebase.c\n\nBest Wishes\n\nPhillip\n\n> \n> The rest of this hunk makes sense.\n> \n>> @@ -672,7 +664,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n>>  # but this should be done only when upstream and onto are the same\n>>  # and if this is not an interactive rebase.\n>>  mb=$(git merge-base \"$onto\" \"$orig_head\")\n>> -if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n>> +if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n>>  \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n>>  \t# linear history?\n>>  \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n>> @@ -716,6 +708,19 @@ then\n>>  \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n>>  fi\n>>  \n>> +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n>> +then\n>> +\t# If the $onto is a proper descendant of the tip of the branch, then\n>> +\t# we just fast-forwarded.\n> \n> This comment is misleading if it comes before, rather than after, the\n> actual `checkout -q` command.\n> \n>> +\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n>> +\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n>> +\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n>> +\tgit update-ref ORIG_HEAD $orig_head\n>> +\tmove_to_original_branch\n>> +\tfinish_rebase\n>> +\texit 0\n>> +fi\n>> +\n>>  test -n \"$interactive_rebase\" && run_specific_rebase\n>>  \n>>  # Detach HEAD and reset the tree\n>> @@ -725,16 +730,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n>>  \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n>>  git update-ref ORIG_HEAD $orig_head\n> \n> It is a pity that this hunk header hides the lines that you copied into\n> the following conditional before moving it before the \"if interactive, run\n> it\" line:\n> \n>>  \n>> -# If the $onto is a proper descendant of the tip of the branch, then\n>> -# we just fast-forwarded.\n>> -if test \"$mb\" = \"$orig_head\"\n>> -then\n>> -\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n>> -\tmove_to_original_branch\n>> -\tfinish_rebase\n>> -\texit 0\n>> -fi\n>> -\n>>  if test -n \"$rebase_root\"\n>>  then\n>>  \trevisions=\"$onto..$orig_head\"\n> \n> What you did is correct, if duplicating code, and definitely the easiest\n> way to do it. Just move the comment, and we're good here.\n> \n>> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n>> deleted file mode 100644\n>> [... snip ...]\n> \n> Nice. Really nice!\n> \n>> diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\n>> index 0392e36d23..04d6c71899 100755\n>> --- a/t/t3406-rebase-message.sh\n>> +++ b/t/t3406-rebase-message.sh\n>> @@ -17,14 +17,9 @@ test_expect_success 'setup' '\n>>  \tgit tag start\n>>  '\n>>  \n>> -cat >expect <<\\EOF\n>> -Already applied: 0001 A\n>> -Already applied: 0002 B\n>> -Committed: 0003 Z\n>> -EOF\n>> -\n> \n> As I had mentioned in the previous round: I think we can retain these\n> messages for the `--merge` mode. And I think we should: users of --merge\n> have most likely become to expect them.\n> \n> The most elegant way would probably be by adding code to the sequencer\n> that outputs these lines if in \"merge\" mode (and add a flag to say that we\n> *are* in \"merge\" mode).\n> \n> To that end, the `make_script()` function would not generate `# pick` but\n> `drop` lines, I think, so that the sequencer can see those and print the\n> `Already applied: <message>` lines. And a successful `TODO_PICK` would\n> write out `Committed: <message>`.\n> \n>>  test_expect_success 'rebase -m' '\n>>  \tgit rebase -m master >report &&\n>> +\t>expect &&\n>>  \tsed -n -e \"/^Already applied: /p\" \\\n>>  \t\t-e \"/^Committed: /p\" report >actual &&\n>>  \ttest_cmp expect actual\n>> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n>> index f355c6825a..49077200c5 100755\n>> --- a/t/t3420-rebase-autostash.sh\n>> +++ b/t/t3420-rebase-autostash.sh\n>> @@ -53,41 +53,6 @@ create_expected_success_interactive () {\n>>  \tEOF\n>>  }\n>>  \n>> -create_expected_success_merge () {\n>> -\tcat >expected <<-EOF\n>> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n>> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n>> -\tFirst, rewinding head to replay your work on top of it...\n>> -\tMerging unrelated-onto-branch with HEAD~1\n>> -\tMerging:\n>> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n>> -\t$(git rev-parse --short feature-branch^) second commit\n>> -\tfound 1 common ancestor:\n>> -\t$(git rev-parse --short feature-branch~2) initial commit\n>> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n>> -\t Author: A U Thor <author@example.com>\n>> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n>> -\t 2 files changed, 2 insertions(+)\n>> -\t create mode 100644 file1\n>> -\t create mode 100644 file2\n>> -\tCommitted: 0001 second commit\n>> -\tMerging unrelated-onto-branch with HEAD~0\n>> -\tMerging:\n>> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n>> -\t$(git rev-parse --short feature-branch) third commit\n>> -\tfound 1 common ancestor:\n>> -\t$(git rev-parse --short feature-branch~1) second commit\n>> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n>> -\t Author: A U Thor <author@example.com>\n>> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n>> -\t 1 file changed, 1 insertion(+)\n>> -\t create mode 100644 file3\n>> -\tCommitted: 0002 third commit\n>> -\tAll done.\n>> -\tApplied autostash.\n>> -\tEOF\n>> -}\n>> -\n>>  create_expected_failure_am () {\n>>  \tcat >expected <<-EOF\n>>  \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n>> @@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n>>  \tEOF\n>>  }\n>>  \n>> -create_expected_failure_merge () {\n>> -\tcat >expected <<-EOF\n>> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n>> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n>> -\tFirst, rewinding head to replay your work on top of it...\n>> -\tMerging unrelated-onto-branch with HEAD~1\n>> -\tMerging:\n>> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n>> -\t$(git rev-parse --short feature-branch^) second commit\n>> -\tfound 1 common ancestor:\n>> -\t$(git rev-parse --short feature-branch~2) initial commit\n>> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n>> -\t Author: A U Thor <author@example.com>\n>> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n>> -\t 2 files changed, 2 insertions(+)\n>> -\t create mode 100644 file1\n>> -\t create mode 100644 file2\n>> -\tCommitted: 0001 second commit\n>> -\tMerging unrelated-onto-branch with HEAD~0\n>> -\tMerging:\n>> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n>> -\t$(git rev-parse --short feature-branch) third commit\n>> -\tfound 1 common ancestor:\n>> -\t$(git rev-parse --short feature-branch~1) second commit\n>> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n>> -\t Author: A U Thor <author@example.com>\n>> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n>> -\t 1 file changed, 1 insertion(+)\n>> -\t create mode 100644 file3\n>> -\tCommitted: 0002 third commit\n>> -\tAll done.\n>> -\tApplying autostash resulted in conflicts.\n>> -\tYour changes are safe in the stash.\n>> -\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n>> -\tEOF\n>> -}\n>> -\n>>  testrebase () {\n>>  \ttype=$1\n>>  \tdotest=$2\n>> @@ -177,6 +105,9 @@ testrebase () {\n>>  \ttest_expect_success \"rebase$type --autostash: check output\" '\n>>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n>>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n>> +\t\tif test ${suffix} = \"merge\"; then\n>> +\t\t\tsuffix=interactive\n>> +\t\tfi &&\n>>  \t\tcreate_expected_success_$suffix &&\n>>  \t\ttest_i18ncmp expected actual\n>>  \t'\n>> @@ -274,6 +205,9 @@ testrebase () {\n>>  \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n>>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n>>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n>> +\t\tif test ${suffix} = \"merge\"; then\n>> +\t\t\tsuffix=interactive\n>> +\t\tfi &&\n>>  \t\tcreate_expected_failure_$suffix &&\n>>  \t\ttest_i18ncmp expected actual\n>>  \t'\n> \n> As I stated earlier, I am uncomfortable with this solution. We change\n> behavior rather noticeably, and the regression test tells us the same. We\n> need to either try to deprecate `git rebase --merge`, or we need to at\n> least attempt to recreate the old behavior with the sequencer.\n> \n>> diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\n>> index 99b2aac921..911ef49f70 100755\n>> --- a/t/t3421-rebase-topology-linear.sh\n>> +++ b/t/t3421-rebase-topology-linear.sh\n>> @@ -111,7 +111,7 @@ test_run_rebase () {\n>>  \t\"\n>>  }\n>>  test_run_rebase success ''\n>> -test_run_rebase failure -m\n>> +test_run_rebase success -m\n>>  test_run_rebase success -i\n>>  test_run_rebase success -p\n>>  \n>> @@ -126,7 +126,7 @@ test_run_rebase () {\n>>  \t\"\n>>  }\n>>  test_run_rebase success ''\n>> -test_run_rebase failure -m\n>> +test_run_rebase success -m\n>>  test_run_rebase success -i\n>>  test_run_rebase success -p\n>>  \n>> @@ -141,7 +141,7 @@ test_run_rebase () {\n>>  \t\"\n>>  }\n>>  test_run_rebase success ''\n>> -test_run_rebase failure -m\n>> +test_run_rebase success -m\n>>  test_run_rebase success -i\n>>  test_run_rebase success -p\n>>  \n>> @@ -284,7 +284,7 @@ test_run_rebase () {\n>>  \t\"\n>>  }\n>>  test_run_rebase success ''\n>> -test_run_rebase failure -m\n>> +test_run_rebase success -m\n>>  test_run_rebase success -i\n>>  test_run_rebase success -p\n>>  \n>> @@ -315,7 +315,7 @@ test_run_rebase () {\n>>  \t\"\n>>  }\n>>  test_run_rebase success ''\n>> -test_run_rebase failure -m\n>> +test_run_rebase success -m\n>>  test_run_rebase success -i\n>>  test_run_rebase failure -p\n>>  \n> \n> Nice.\n> \n>> diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n>> index 846f85c27e..cd505c0711 100755\n>> --- a/t/t3425-rebase-topology-merges.sh\n>> +++ b/t/t3425-rebase-topology-merges.sh\n>> @@ -72,7 +72,7 @@ test_run_rebase () {\n>>  }\n>>  #TODO: make order consistent across all flavors of rebase\n>>  test_run_rebase success 'e n o' ''\n>> -test_run_rebase success 'e n o' -m\n>> +test_run_rebase success 'n o e' -m\n>>  test_run_rebase success 'n o e' -i\n>>  \n>>  test_run_rebase () {\n>> @@ -89,7 +89,7 @@ test_run_rebase () {\n>>  }\n>>  #TODO: make order consistent across all flavors of rebase\n>>  test_run_rebase success 'd e n o' ''\n>> -test_run_rebase success 'd e n o' -m\n>> +test_run_rebase success 'd n o e' -m\n>>  test_run_rebase success 'd n o e' -i\n>>  \n>>  test_run_rebase () {\n>> @@ -106,7 +106,7 @@ test_run_rebase () {\n>>  }\n>>  #TODO: make order consistent across all flavors of rebase\n>>  test_run_rebase success 'd e n o' ''\n>> -test_run_rebase success 'd e n o' -m\n>> +test_run_rebase success 'd n o e' -m\n>>  test_run_rebase success 'd n o e' -i\n>>  \n>>  test_expect_success \"rebase -p is no-op in non-linear history\" \"\n> \n> This is a bit unfortunate. I wonder if we could do something like this, to\n> retain the current behavior:\n> \n> -- snip --\n> diff --git a/sequencer.c b/sequencer.c\n> index 9e1ab3a2a7..5018957e49 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -4394,7 +4394,8 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,\n>  \trevs.reverse = 1;\n>  \trevs.right_only = 1;\n>  \trevs.sort_order = REV_SORT_IN_GRAPH_ORDER;\n> -\trevs.topo_order = 1;\n> +\tif (!(flags & TODO_LIST_NO_TOPO_ORDER))\n> +\t\trevs.topo_order = 1;\n>  \n>  \trevs.pretty_given = 1;\n>  \tgit_config_get_string(\"rebase.instructionFormat\", &format);\n> -- snap -\n> \n> (and then pass TODO_LIST_NO_TOPO_ORDER if in \"merge\" mode)?\n> \n>> diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\n>> index 9b2a274c71..145c61251d 100755\n>> --- a/t/t5407-post-rewrite-hook.sh\n>> +++ b/t/t5407-post-rewrite-hook.sh\n>> @@ -120,6 +120,7 @@ test_expect_success 'git rebase -m --skip' '\n>>  \tgit rebase --continue &&\n>>  \techo rebase >expected.args &&\n>>  \tcat >expected.data <<-EOF &&\n>> +\t$(git rev-parse C) $(git rev-parse HEAD^)\n>>  \t$(git rev-parse D) $(git rev-parse HEAD)\n>>  \tEOF\n>>  \tverify_hook_input\n> \n> This suggests to me that we call `commit` too many times. I think we\n> really need to address this without changing the test. This is a change in\n> behavior.\n> \n>> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n>> index 81a5179e28..5cadedb2a9 100755\n>> --- a/t/t9903-bash-prompt.sh\n>> +++ b/t/t9903-bash-prompt.sh\n>> @@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n>>  '\n>>  \n>>  test_expect_success 'prompt - rebase merge' '\n>> -\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n>> +\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n> \n> As I said, this should be easily addressed by having a tell-tale in\n> $state_dir/. Come to think of it, we must have had one, right? Let's see\n> how the bash-prompt does it.\n> \n> *clicketyclick*\n> \n> Ah, it is the *absence* of the `interactive` file... Which makes me wonder\n> whether we should not simply retain that behavior for `git rebase\n> --merge`?\n> \n>>  \tgit checkout b2 &&\n>>  \ttest_when_finished \"git checkout master\" &&\n>>  \ttest_must_fail git rebase --merge b1 b2 &&\n>> -- \n>> 2.19.1.858.g526e8fe740.dirty\n>>\n>>\n> \n> Thank you for this pleasant read. I think there is still quite a bit of\n> work to do, but you already did most of it.\n> \n> Out of curiosity, do you have a public repository with these patches in a\n> branch? (I might have an hour to play with it tonight...)\n> \n> Thanks!\n> Dscho\n> \n\n"},{"id":"363136","messageId":"nycvar.QRO.7.76.6.1811131017250.39@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"f0231c21-8727-94cb-96aa-13ebfb5b7283@talktalk.net","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-13T09:18:17Z","receivedAt":"2018-11-13T09:18:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Phillip,\n\nOn Mon, 12 Nov 2018, Phillip Wood wrote:\n\n> It's good to see these patches progressing, I've just got a couple of\n> comments related to Johannes' points below\n> \n> On 12/11/2018 16:21, Johannes Schindelin wrote:\n> > Hi Elijah,\n> > \n> > On Wed, 7 Nov 2018, Elijah Newren wrote:\n> > \n> >> Interactive rebases are implemented in terms of cherry-pick rather than\n> >> the merge-recursive builtin, but cherry-pick also calls into the recursive\n> >> merge machinery by default and can accept special merge strategies and/or\n> >> special strategy options.  As such, there really is not any need for\n> >> having both git-rebase--merge and git-rebase--interactive anymore.\n> >>\n> >> Delete git-rebase--merge.sh and have the --merge option be implemented\n> >> by the now built-in interactive machinery.\n> > \n> > Okay.\n> > \n> >> Note that this change fixes a few known test failures (see t3421).\n> > \n> > Nice!\n> > \n> >> testcase modification notes:\n> >>   t3406: --interactive and --merge had slightly different progress output\n> >>          while running; adjust a test to match\n> >>   t3420: these test precise output while running, but rebase--am,\n> >>          rebase--merge, and rebase--interactive all were built on very\n> >>          different commands (am, merge-recursive, cherry-pick), so the\n> >>          tests expected different output for each type.  Now we expect\n> >>          --merge and --interactive to have the same output.\n> >>   t3421: --interactive fixes some bugs in --merge!  Wahoo!\n> >>   t3425: topology linearization was inconsistent across flavors of rebase,\n> >>          as already noted in a TODO comment in the testcase.  This was not\n> >>          considered a bug before, so getting a different linearization due\n> >>          to switching out backends should not be considered a bug now.\n> > \n> > Ideally, the test would be fixed, then. If it fails for other reasons than\n> > a real regression, it is not a very good regression test, is it.\n> > \n> >>   t5407: different rebase types varied slightly in how many times checkout\n> >>          or commit or equivalents were called based on a quick comparison\n> >>          of this tests and previous ones which covered different rebase\n> >>          flavors.  I think this is just attributable to this difference.\n> > \n> > This concerns me.\n> > \n> > In bigger repositories (no, I am not talking about Linux kernel sized\n> > ones, I consider those small-ish) there are a ton of files, and checkout\n> > and commit (and even more so reset) sadly do not have a runtime complexity\n> > growing with the number of modified files, but with the number of tracked\n> > files (and some commands even with the number of worktree files).\n> > \n> > So a larger number of commit/checkout operations makes me expect\n> > performance regressions.\n> > \n> > In this light, could you elaborate a bit on the differences you see\n> > between rebase -i and rebase -m?\n> > \n> >>   t9903: --merge uses the interactive backend so the prompt expected is\n> >>          now REBASE-i.\n> > \n> > We should be able to make that test pass, still, by writing out a special\n> > file (e.g. $state_dir/opt_m) and testing for that. Users are oddly upset\n> > when their expectations are broken... (and I actually agree with them.)\n> > \n> >> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> >> index 3407d835bd..35084f5681 100644\n> >> --- a/Documentation/git-rebase.txt\n> >> +++ b/Documentation/git-rebase.txt\n> >> @@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n> >>  INCOMPATIBLE OPTIONS\n> >>  --------------------\n> >>  \n> >> -git-rebase has many flags that are incompatible with each other,\n> >> -predominantly due to the fact that it has three different underlying\n> >> -implementations:\n> >> -\n> >> - * one based on linkgit:git-am[1] (the default)\n> >> - * one based on git-merge-recursive (merge backend)\n> >> - * one based on linkgit:git-cherry-pick[1] (interactive backend)\n> >> -\n> > \n> > Could we retain this part, with `s/three/two/` and `/git-merge/d`? *Maybe*\n> > `s/interactive backend/interactive\\/merge backend/`\n> \n> I was hoping we could get rid of that, I'm not sure how useful it is to\n> users.\n\nThat's a good point. If the commit message makes the case for that (it is\nan implementation detail that confuses users), I am fine with removing it,\ntoo.\n\nThanks,\nDscho\n\n> \n> > \n> >> -Flags only understood by the am backend:\n> >> +The following options:\n> >>  \n> >>   * --committer-date-is-author-date\n> >>   * --ignore-date\n> >> @@ -520,15 +512,12 @@ Flags only understood by the am backend:\n> >>   * --ignore-whitespace\n> >>   * -C\n> >>  \n> >> -Flags understood by both merge and interactive backends:\n> >> +are incompatible with the following options:\n> >>  \n> >>   * --merge\n> >>   * --strategy\n> >>   * --strategy-option\n> >>   * --allow-empty-message\n> >> -\n> >> -Flags only understood by the interactive backend:\n> >> -\n> \n> It's nice to see this being simplified\n> \n> >>   * --[no-]autosquash\n> >>   * --rebase-merges\n> >>   * --preserve-merges\n> >> @@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n> >>   * --edit-todo\n> >>   * --root when used in combination with --onto\n> >>  \n> >> -Other incompatible flag pairs:\n> >> +In addition, the following pairs of options are incompatible:\n> >>  \n> >>   * --preserve-merges and --interactive\n> >>   * --preserve-merges and --signoff\n> > \n> > The rest of the diff is funny to read, but the post image makes a lot of\n> > sense.\n> > \n> >> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> >> index be004406a6..d55bbb9eb9 100644\n> >> --- a/builtin/rebase.c\n> >> +++ b/builtin/rebase.c\n> >> @@ -118,7 +118,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n> >>  \tcase REBASE_PRESERVE_MERGES:\n> >>  \t\tbreak;\n> >>  \tcase REBASE_MERGE:\n> >> -\t\t/* we silently *upgrade* --merge to --interactive if needed */\n> >> +\t\t/* we now implement --merge via --interactive */\n> >>  \tdefault:\n> >>  \t\topts->type = REBASE_INTERACTIVE; /* implied */\n> >>  \t\tbreak;\n> >> @@ -475,10 +475,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n> >>  \t\tbackend = \"git-rebase--am\";\n> >>  \t\tbackend_func = \"git_rebase__am\";\n> >>  \t\tbreak;\n> >> -\tcase REBASE_MERGE:\n> >> -\t\tbackend = \"git-rebase--merge\";\n> >> -\t\tbackend_func = \"git_rebase__merge\";\n> >> -\t\tbreak;\n> >>  \tcase REBASE_PRESERVE_MERGES:\n> >>  \t\tbackend = \"git-rebase--preserve-merges\";\n> >>  \t\tbackend_func = \"git_rebase__preserve_merges\";\n> >> @@ -1156,6 +1152,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n> >>  \t\t}\n> >>  \t}\n> >>  \n> >> +\tif (options.type == REBASE_MERGE) {\n> >> +\t\timply_interactive(&options, \"--merge\");\n> >> +\t}\n> >> +\n> >>  \tif (options.root && !options.onto_name)\n> >>  \t\timply_interactive(&options, \"--root without --onto\");\n> >>  \n> > \n> > Okay, this makes sense.\n> > \n> >> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n> >> index da27bfca5a..4abcceed06 100755\n> >> --- a/git-legacy-rebase.sh\n> >> +++ b/git-legacy-rebase.sh\n> >> @@ -218,6 +218,7 @@ then\n> >>  \tstate_dir=\"$apply_dir\"\n> >>  elif test -d \"$merge_dir\"\n> >>  then\n> >> +\ttype=interactive\n> >>  \tif test -d \"$merge_dir\"/rewritten\n> >>  \tthen\n> >>  \t\ttype=preserve-merges\n> >> @@ -225,10 +226,7 @@ then\n> >>  \t\tpreserve_merges=t\n> >>  \telif test -f \"$merge_dir\"/interactive\n> >>  \tthen\n> >> -\t\ttype=interactive\n> >>  \t\tinteractive_rebase=explicit\n> >> -\telse\n> >> -\t\ttype=merge\n> >>  \tfi\n> >>  \tstate_dir=\"$merge_dir\"\n> >>  fi\n> >> @@ -469,6 +467,7 @@ then\n> >>  \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n> >>  fi\n> >>  \n> >> +actually_interactive=\n> >>  if test -n \"$interactive_rebase\"\n> >>  then\n> >>  \tif test -z \"$preserve_merges\"\n> >> @@ -477,11 +476,12 @@ then\n> >>  \telse\n> >>  \t\ttype=preserve-merges\n> >>  \tfi\n> >> -\n> >> +\tactually_interactive=t\n> >>  \tstate_dir=\"$merge_dir\"\n> >>  elif test -n \"$do_merge\"\n> >>  then\n> >> -\ttype=merge\n> >> +\tinteractive_rebase=implied\n> >> +\ttype=interactive\n> >>  \tstate_dir=\"$merge_dir\"\n> >>  else\n> >>  \ttype=am\n> >> @@ -493,21 +493,13 @@ then\n> >>  \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n> >>  fi\n> >>  \n> >> -if test -n \"$git_am_opt\"; then\n> >> -\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n> >> -\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> >> -\tif test -n \"$interactive_rebase\"\n> >> +incompatible_opts=$(echo \" $git_am_opt \" | \\\n> >> +\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> > \n> > Why are we no longer guarding this behind the condition that the user\n> > specified *any* option intended for the `am` backend?\n> \n> I was confused by this as well, what if the user asks for 'rebase\n> --exec=<cmd> --ignore-whitespace'?\n> \n> > \n> >> +if test -n \"$incompatible_opts\"\n> >> +then\n> >> +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n> >>  \tthen\n> >> -\t\tif test -n \"$incompatible_opts\"\n> >> -\t\tthen\n> >> -\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> >> -\t\tfi\n> >> -\tfi\n> >> -\tif test -n \"$do_merge\"; then\n> >> -\t\tif test -n \"$incompatible_opts\"\n> >> -\t\tthen\n> >> -\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> >> -\t\tfi\n> >> +\t\tdie \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n> >>  \tfi\n> >>  fi\n> >>  \n> \n> If you want to change the error message here, I think you need to change\n> the corresponding message in builtin/rebase.c\n> \n> Best Wishes\n> \n> Phillip\n> \n> > \n> > The rest of this hunk makes sense.\n> > \n> >> @@ -672,7 +664,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n> >>  # but this should be done only when upstream and onto are the same\n> >>  # and if this is not an interactive rebase.\n> >>  mb=$(git merge-base \"$onto\" \"$orig_head\")\n> >> -if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n> >> +if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n> >>  \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n> >>  \t# linear history?\n> >>  \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n> >> @@ -716,6 +708,19 @@ then\n> >>  \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n> >>  fi\n> >>  \n> >> +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n> >> +then\n> >> +\t# If the $onto is a proper descendant of the tip of the branch, then\n> >> +\t# we just fast-forwarded.\n> > \n> > This comment is misleading if it comes before, rather than after, the\n> > actual `checkout -q` command.\n> > \n> >> +\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> >> +\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n> >> +\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n> >> +\tgit update-ref ORIG_HEAD $orig_head\n> >> +\tmove_to_original_branch\n> >> +\tfinish_rebase\n> >> +\texit 0\n> >> +fi\n> >> +\n> >>  test -n \"$interactive_rebase\" && run_specific_rebase\n> >>  \n> >>  # Detach HEAD and reset the tree\n> >> @@ -725,16 +730,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n> >>  \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n> >>  git update-ref ORIG_HEAD $orig_head\n> > \n> > It is a pity that this hunk header hides the lines that you copied into\n> > the following conditional before moving it before the \"if interactive, run\n> > it\" line:\n> > \n> >>  \n> >> -# If the $onto is a proper descendant of the tip of the branch, then\n> >> -# we just fast-forwarded.\n> >> -if test \"$mb\" = \"$orig_head\"\n> >> -then\n> >> -\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> >> -\tmove_to_original_branch\n> >> -\tfinish_rebase\n> >> -\texit 0\n> >> -fi\n> >> -\n> >>  if test -n \"$rebase_root\"\n> >>  then\n> >>  \trevisions=\"$onto..$orig_head\"\n> > \n> > What you did is correct, if duplicating code, and definitely the easiest\n> > way to do it. Just move the comment, and we're good here.\n> > \n> >> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n> >> deleted file mode 100644\n> >> [... snip ...]\n> > \n> > Nice. Really nice!\n> > \n> >> diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\n> >> index 0392e36d23..04d6c71899 100755\n> >> --- a/t/t3406-rebase-message.sh\n> >> +++ b/t/t3406-rebase-message.sh\n> >> @@ -17,14 +17,9 @@ test_expect_success 'setup' '\n> >>  \tgit tag start\n> >>  '\n> >>  \n> >> -cat >expect <<\\EOF\n> >> -Already applied: 0001 A\n> >> -Already applied: 0002 B\n> >> -Committed: 0003 Z\n> >> -EOF\n> >> -\n> > \n> > As I had mentioned in the previous round: I think we can retain these\n> > messages for the `--merge` mode. And I think we should: users of --merge\n> > have most likely become to expect them.\n> > \n> > The most elegant way would probably be by adding code to the sequencer\n> > that outputs these lines if in \"merge\" mode (and add a flag to say that we\n> > *are* in \"merge\" mode).\n> > \n> > To that end, the `make_script()` function would not generate `# pick` but\n> > `drop` lines, I think, so that the sequencer can see those and print the\n> > `Already applied: <message>` lines. And a successful `TODO_PICK` would\n> > write out `Committed: <message>`.\n> > \n> >>  test_expect_success 'rebase -m' '\n> >>  \tgit rebase -m master >report &&\n> >> +\t>expect &&\n> >>  \tsed -n -e \"/^Already applied: /p\" \\\n> >>  \t\t-e \"/^Committed: /p\" report >actual &&\n> >>  \ttest_cmp expect actual\n> >> diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n> >> index f355c6825a..49077200c5 100755\n> >> --- a/t/t3420-rebase-autostash.sh\n> >> +++ b/t/t3420-rebase-autostash.sh\n> >> @@ -53,41 +53,6 @@ create_expected_success_interactive () {\n> >>  \tEOF\n> >>  }\n> >>  \n> >> -create_expected_success_merge () {\n> >> -\tcat >expected <<-EOF\n> >> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> >> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n> >> -\tFirst, rewinding head to replay your work on top of it...\n> >> -\tMerging unrelated-onto-branch with HEAD~1\n> >> -\tMerging:\n> >> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n> >> -\t$(git rev-parse --short feature-branch^) second commit\n> >> -\tfound 1 common ancestor:\n> >> -\t$(git rev-parse --short feature-branch~2) initial commit\n> >> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> >> -\t Author: A U Thor <author@example.com>\n> >> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n> >> -\t 2 files changed, 2 insertions(+)\n> >> -\t create mode 100644 file1\n> >> -\t create mode 100644 file2\n> >> -\tCommitted: 0001 second commit\n> >> -\tMerging unrelated-onto-branch with HEAD~0\n> >> -\tMerging:\n> >> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n> >> -\t$(git rev-parse --short feature-branch) third commit\n> >> -\tfound 1 common ancestor:\n> >> -\t$(git rev-parse --short feature-branch~1) second commit\n> >> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> >> -\t Author: A U Thor <author@example.com>\n> >> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n> >> -\t 1 file changed, 1 insertion(+)\n> >> -\t create mode 100644 file3\n> >> -\tCommitted: 0002 third commit\n> >> -\tAll done.\n> >> -\tApplied autostash.\n> >> -\tEOF\n> >> -}\n> >> -\n> >>  create_expected_failure_am () {\n> >>  \tcat >expected <<-EOF\n> >>  \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> >> @@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n> >>  \tEOF\n> >>  }\n> >>  \n> >> -create_expected_failure_merge () {\n> >> -\tcat >expected <<-EOF\n> >> -\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> >> -\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n> >> -\tFirst, rewinding head to replay your work on top of it...\n> >> -\tMerging unrelated-onto-branch with HEAD~1\n> >> -\tMerging:\n> >> -\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n> >> -\t$(git rev-parse --short feature-branch^) second commit\n> >> -\tfound 1 common ancestor:\n> >> -\t$(git rev-parse --short feature-branch~2) initial commit\n> >> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> >> -\t Author: A U Thor <author@example.com>\n> >> -\t Date: Thu Apr 7 15:14:13 2005 -0700\n> >> -\t 2 files changed, 2 insertions(+)\n> >> -\t create mode 100644 file1\n> >> -\t create mode 100644 file2\n> >> -\tCommitted: 0001 second commit\n> >> -\tMerging unrelated-onto-branch with HEAD~0\n> >> -\tMerging:\n> >> -\t$(git rev-parse --short rebased-feature-branch~1) second commit\n> >> -\t$(git rev-parse --short feature-branch) third commit\n> >> -\tfound 1 common ancestor:\n> >> -\t$(git rev-parse --short feature-branch~1) second commit\n> >> -\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> >> -\t Author: A U Thor <author@example.com>\n> >> -\t Date: Thu Apr 7 15:15:13 2005 -0700\n> >> -\t 1 file changed, 1 insertion(+)\n> >> -\t create mode 100644 file3\n> >> -\tCommitted: 0002 third commit\n> >> -\tAll done.\n> >> -\tApplying autostash resulted in conflicts.\n> >> -\tYour changes are safe in the stash.\n> >> -\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n> >> -\tEOF\n> >> -}\n> >> -\n> >>  testrebase () {\n> >>  \ttype=$1\n> >>  \tdotest=$2\n> >> @@ -177,6 +105,9 @@ testrebase () {\n> >>  \ttest_expect_success \"rebase$type --autostash: check output\" '\n> >>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n> >>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n> >> +\t\tif test ${suffix} = \"merge\"; then\n> >> +\t\t\tsuffix=interactive\n> >> +\t\tfi &&\n> >>  \t\tcreate_expected_success_$suffix &&\n> >>  \t\ttest_i18ncmp expected actual\n> >>  \t'\n> >> @@ -274,6 +205,9 @@ testrebase () {\n> >>  \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n> >>  \t\ttest_when_finished git branch -D rebased-feature-branch &&\n> >>  \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n> >> +\t\tif test ${suffix} = \"merge\"; then\n> >> +\t\t\tsuffix=interactive\n> >> +\t\tfi &&\n> >>  \t\tcreate_expected_failure_$suffix &&\n> >>  \t\ttest_i18ncmp expected actual\n> >>  \t'\n> > \n> > As I stated earlier, I am uncomfortable with this solution. We change\n> > behavior rather noticeably, and the regression test tells us the same. We\n> > need to either try to deprecate `git rebase --merge`, or we need to at\n> > least attempt to recreate the old behavior with the sequencer.\n> > \n> >> diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\n> >> index 99b2aac921..911ef49f70 100755\n> >> --- a/t/t3421-rebase-topology-linear.sh\n> >> +++ b/t/t3421-rebase-topology-linear.sh\n> >> @@ -111,7 +111,7 @@ test_run_rebase () {\n> >>  \t\"\n> >>  }\n> >>  test_run_rebase success ''\n> >> -test_run_rebase failure -m\n> >> +test_run_rebase success -m\n> >>  test_run_rebase success -i\n> >>  test_run_rebase success -p\n> >>  \n> >> @@ -126,7 +126,7 @@ test_run_rebase () {\n> >>  \t\"\n> >>  }\n> >>  test_run_rebase success ''\n> >> -test_run_rebase failure -m\n> >> +test_run_rebase success -m\n> >>  test_run_rebase success -i\n> >>  test_run_rebase success -p\n> >>  \n> >> @@ -141,7 +141,7 @@ test_run_rebase () {\n> >>  \t\"\n> >>  }\n> >>  test_run_rebase success ''\n> >> -test_run_rebase failure -m\n> >> +test_run_rebase success -m\n> >>  test_run_rebase success -i\n> >>  test_run_rebase success -p\n> >>  \n> >> @@ -284,7 +284,7 @@ test_run_rebase () {\n> >>  \t\"\n> >>  }\n> >>  test_run_rebase success ''\n> >> -test_run_rebase failure -m\n> >> +test_run_rebase success -m\n> >>  test_run_rebase success -i\n> >>  test_run_rebase success -p\n> >>  \n> >> @@ -315,7 +315,7 @@ test_run_rebase () {\n> >>  \t\"\n> >>  }\n> >>  test_run_rebase success ''\n> >> -test_run_rebase failure -m\n> >> +test_run_rebase success -m\n> >>  test_run_rebase success -i\n> >>  test_run_rebase failure -p\n> >>  \n> > \n> > Nice.\n> > \n> >> diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n> >> index 846f85c27e..cd505c0711 100755\n> >> --- a/t/t3425-rebase-topology-merges.sh\n> >> +++ b/t/t3425-rebase-topology-merges.sh\n> >> @@ -72,7 +72,7 @@ test_run_rebase () {\n> >>  }\n> >>  #TODO: make order consistent across all flavors of rebase\n> >>  test_run_rebase success 'e n o' ''\n> >> -test_run_rebase success 'e n o' -m\n> >> +test_run_rebase success 'n o e' -m\n> >>  test_run_rebase success 'n o e' -i\n> >>  \n> >>  test_run_rebase () {\n> >> @@ -89,7 +89,7 @@ test_run_rebase () {\n> >>  }\n> >>  #TODO: make order consistent across all flavors of rebase\n> >>  test_run_rebase success 'd e n o' ''\n> >> -test_run_rebase success 'd e n o' -m\n> >> +test_run_rebase success 'd n o e' -m\n> >>  test_run_rebase success 'd n o e' -i\n> >>  \n> >>  test_run_rebase () {\n> >> @@ -106,7 +106,7 @@ test_run_rebase () {\n> >>  }\n> >>  #TODO: make order consistent across all flavors of rebase\n> >>  test_run_rebase success 'd e n o' ''\n> >> -test_run_rebase success 'd e n o' -m\n> >> +test_run_rebase success 'd n o e' -m\n> >>  test_run_rebase success 'd n o e' -i\n> >>  \n> >>  test_expect_success \"rebase -p is no-op in non-linear history\" \"\n> > \n> > This is a bit unfortunate. I wonder if we could do something like this, to\n> > retain the current behavior:\n> > \n> > -- snip --\n> > diff --git a/sequencer.c b/sequencer.c\n> > index 9e1ab3a2a7..5018957e49 100644\n> > --- a/sequencer.c\n> > +++ b/sequencer.c\n> > @@ -4394,7 +4394,8 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,\n> >  \trevs.reverse = 1;\n> >  \trevs.right_only = 1;\n> >  \trevs.sort_order = REV_SORT_IN_GRAPH_ORDER;\n> > -\trevs.topo_order = 1;\n> > +\tif (!(flags & TODO_LIST_NO_TOPO_ORDER))\n> > +\t\trevs.topo_order = 1;\n> >  \n> >  \trevs.pretty_given = 1;\n> >  \tgit_config_get_string(\"rebase.instructionFormat\", &format);\n> > -- snap -\n> > \n> > (and then pass TODO_LIST_NO_TOPO_ORDER if in \"merge\" mode)?\n> > \n> >> diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\n> >> index 9b2a274c71..145c61251d 100755\n> >> --- a/t/t5407-post-rewrite-hook.sh\n> >> +++ b/t/t5407-post-rewrite-hook.sh\n> >> @@ -120,6 +120,7 @@ test_expect_success 'git rebase -m --skip' '\n> >>  \tgit rebase --continue &&\n> >>  \techo rebase >expected.args &&\n> >>  \tcat >expected.data <<-EOF &&\n> >> +\t$(git rev-parse C) $(git rev-parse HEAD^)\n> >>  \t$(git rev-parse D) $(git rev-parse HEAD)\n> >>  \tEOF\n> >>  \tverify_hook_input\n> > \n> > This suggests to me that we call `commit` too many times. I think we\n> > really need to address this without changing the test. This is a change in\n> > behavior.\n> > \n> >> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> >> index 81a5179e28..5cadedb2a9 100755\n> >> --- a/t/t9903-bash-prompt.sh\n> >> +++ b/t/t9903-bash-prompt.sh\n> >> @@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n> >>  '\n> >>  \n> >>  test_expect_success 'prompt - rebase merge' '\n> >> -\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n> >> +\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n> > \n> > As I said, this should be easily addressed by having a tell-tale in\n> > $state_dir/. Come to think of it, we must have had one, right? Let's see\n> > how the bash-prompt does it.\n> > \n> > *clicketyclick*\n> > \n> > Ah, it is the *absence* of the `interactive` file... Which makes me wonder\n> > whether we should not simply retain that behavior for `git rebase\n> > --merge`?\n> > \n> >>  \tgit checkout b2 &&\n> >>  \ttest_when_finished \"git checkout master\" &&\n> >>  \ttest_must_fail git rebase --merge b1 b2 &&\n> >> -- \n> >> 2.19.1.858.g526e8fe740.dirty\n> >>\n> >>\n> > \n> > Thank you for this pleasant read. I think there is still quite a bit of\n> > work to do, but you already did most of it.\n> > \n> > Out of curiosity, do you have a public repository with these patches in a\n> > branch? (I might have an hour to play with it tonight...)\n> > \n> > Thanks!\n> > Dscho\n> > \n> \n> \n"},{"id":"363175","messageId":"CABPp-BHBh1ubHvB=oHFeqiQyfDWuCO_r93hL82y7HkNXLDOUTA@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1811121614190.39@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-13T16:06:26Z","receivedAt":"2018-11-13T16:06:42Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Dscho,\n\nThanks for the detailed review!  I'll try to get back to all your\ncomments, but for now I feel bad that I didn't see and respond to at\nleast one sooner...\n\nOn Mon, Nov 12, 2018 at 8:21 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Thank you for this pleasant read. I think there is still quite a bit of\n> work to do, but you already did most of it.\n>\n> Out of curiosity, do you have a public repository with these patches in a\n> branch? (I might have an hour to play with it tonight...)\n\nhttps://github.com/newren/git/tree/rebase-new-default, but ignore the\nlast two commits; they are separate and haven't been brought up to\ndate despite having been minimally rebased.\n"},{"id":"363403","messageId":"CABPp-BHgeSGxVe1ThZcX=5Q4wO_-frm59=CwwrJxNRcHXiPTqQ@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1811121614190.39@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-14T23:03:33Z","receivedAt":"2018-11-14T23:03:50Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Dscho,\n\nOn Mon, Nov 12, 2018 at 8:21 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> >   t3425: topology linearization was inconsistent across flavors of rebase,\n> >          as already noted in a TODO comment in the testcase.  This was not\n> >          considered a bug before, so getting a different linearization due\n> >          to switching out backends should not be considered a bug now.\n>\n> Ideally, the test would be fixed, then. If it fails for other reasons than\n> a real regression, it is not a very good regression test, is it.\n\nI agree, it's not the best regression test.  It'd be better if it\ndefined and tested for \"the correct behavior\", but I suspect it has\nsome value in that it's is guaranteeing that the rebase flavors at\nleast give a \"somewhat reasonable\" result.  Sadly, It just allowed all\nthree rebase types to have slightly different \"somewhat reasonable\"\nanswers.\n\n>\n> >   t5407: different rebase types varied slightly in how many times checkout\n> >          or commit or equivalents were called based on a quick comparison\n> >          of this tests and previous ones which covered different rebase\n> >          flavors.  I think this is just attributable to this difference.\n>\n> This concerns me.\n>\n> In bigger repositories (no, I am not talking about Linux kernel sized\n> ones, I consider those small-ish) there are a ton of files, and checkout\n> and commit (and even more so reset) sadly do not have a runtime complexity\n> growing with the number of modified files, but with the number of tracked\n> files (and some commands even with the number of worktree files).\n>\n> So a larger number of commit/checkout operations makes me expect\n> performance regressions.\n>\n> In this light, could you elaborate a bit on the differences you see\n> between rebase -i and rebase -m?\n\nI wrote this comment months ago and don't remember the full details.\nFrom the wording and as best I remember, I suspect I was at least\npartially annoyed by the fact that these and other regression tests\nfor rebase seemed to not be testing for \"correct\" behavior, but\n\"existing\" behavior.  That wouldn't be so bad, except that existing\nbehavior differed on the exact same test setup for different rebase\nbackends and the differences in behavior were checked and enforced in\nthe regression tests.  So, it became a matter of taste as to how much\nthings should be made identical and to which backend, or whether it\nwas more important to at least just consolidate the code first and\nkeep the results at least reasonable.  At the time, I figured getting\nfewer backends, all with reasonable behavior was a bit more important,\nbut since this difference is worrisome to you, I will try to dig\nfurther into it.\n\n> >   t9903: --merge uses the interactive backend so the prompt expected is\n> >          now REBASE-i.\n>\n> We should be able to make that test pass, still, by writing out a special\n> file (e.g. $state_dir/opt_m) and testing for that. Users are oddly upset\n> when their expectations are broken... (and I actually agree with them.)\n\nI agree users are upset when expectations are broken, but why would\nthey expect REBASE-m?  In fact, I thought the prompt was a reflection\nof what backend was in use, so that if someone reported an issue to\nthe git mailing list or a power user wanted to know where the control\nfiles were located, they could look for them.  As such, I thought that\nswitching the prompt to REBASE-i was the right thing to do so that it\nwould match user expectations.  Yes, the backend changed; that's part\nof the release notes.\n\nIs there documentation somewhere that specifies the meaning of this\nprompt differently than the expectations I had somehow built up?\n\n> > diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> > index 3407d835bd..35084f5681 100644\n> > --- a/Documentation/git-rebase.txt\n> > +++ b/Documentation/git-rebase.txt\n> > @@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n> >  INCOMPATIBLE OPTIONS\n> >  --------------------\n> >\n> > -git-rebase has many flags that are incompatible with each other,\n> > -predominantly due to the fact that it has three different underlying\n> > -implementations:\n> > -\n> > - * one based on linkgit:git-am[1] (the default)\n> > - * one based on git-merge-recursive (merge backend)\n> > - * one based on linkgit:git-cherry-pick[1] (interactive backend)\n> > -\n>\n> Could we retain this part, with `s/three/two/` and `/git-merge/d`? *Maybe*\n> `s/interactive backend/interactive\\/merge backend/`\n\nRemoving this was actually a suggestion by Phillip back in June at the\nend of https://public-inbox.org/git/13ccb4d9-582b-d26b-f595-59cb0b7037ab@talktalk.net/,\nfor the purpose of removing an implementation details that users don't\nneed to know about.  As noted elsewhere in the thread, between you and\nPhillip, I'll add some comments to the commit message about this.\n\n> > -if test -n \"$git_am_opt\"; then\n> > -     incompatible_opts=$(echo \" $git_am_opt \" | \\\n> > -                         sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> > -     if test -n \"$interactive_rebase\"\n> > +incompatible_opts=$(echo \" $git_am_opt \" | \\\n> > +                 sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n>\n> Why are we no longer guarding this behind the condition that the user\n> specified *any* option intended for the `am` backend?\n\nThe code is still correctly guarding, the diff is just confusing.\nSorry about that.  To explain, the code previously was basically:\n\nif git_am_opt:\n  if interactive:\n    if incompatible_opts:\n      show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    if incompatible_opts\n      show_error_about_merge_and_am_incompatibilities\n\nwhich was a triply nested if, and the first (git_am_opt) and third\n(incompatible_opts) were slightly redundant; the latter being a subset\nof the former.  Perhaps I should have done a separate cleanup patch\nbefore this that changed it to:\n\nif incomptable_opts:\n  if interactive:\n    show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    show_error_about_merge_and_am_incompatibilities\n\nBefore then having this patch coalesce that down to:\n\nif incomptable_opts:\n  if interactive:\n    show_error_about_incompatible_options\n\nSince it tripped up both you and Phillip, I'll add this preliminary\ncleanup as a separate commit with accompanying explanation in my next\nre-roll.\n\n\n> > @@ -672,7 +664,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n> >  # but this should be done only when upstream and onto are the same\n> >  # and if this is not an interactive rebase.\n> >  mb=$(git merge-base \"$onto\" \"$orig_head\")\n> > -if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n> > +if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n> >       test \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n> >       # linear history?\n> >       ! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n> > @@ -716,6 +708,19 @@ then\n> >       GIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n> >  fi\n> >\n> > +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n> > +then\n> > +     # If the $onto is a proper descendant of the tip of the branch, then\n> > +     # we just fast-forwarded.\n>\n> This comment is misleading if it comes before, rather than after, the\n> actual `checkout -q` command.\n>\n> > +     say \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> > +     GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n> > +             git checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n> > +     git update-ref ORIG_HEAD $orig_head\n> > +     move_to_original_branch\n> > +     finish_rebase\n> > +     exit 0\n> > +fi\n> > +\n> >  test -n \"$interactive_rebase\" && run_specific_rebase\n> >\n> >  # Detach HEAD and reset the tree\n> > @@ -725,16 +730,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n> >       git checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n> >  git update-ref ORIG_HEAD $orig_head\n>\n> It is a pity that this hunk header hides the lines that you copied into\n> the following conditional before moving it before the \"if interactive, run\n> it\" line:\n>\n> >\n> > -# If the $onto is a proper descendant of the tip of the branch, then\n> > -# we just fast-forwarded.\n> > -if test \"$mb\" = \"$orig_head\"\n> > -then\n> > -     say \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n> > -     move_to_original_branch\n> > -     finish_rebase\n> > -     exit 0\n> > -fi\n> > -\n> >  if test -n \"$rebase_root\"\n> >  then\n> >       revisions=\"$onto..$orig_head\"\n>\n> What you did is correct, if duplicating code, and definitely the easiest\n> way to do it. Just move the comment, and we're good here.\n\nWill do.\n\n>\n> > diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n> > deleted file mode 100644\n> > [... snip ...]\n>\n> Nice. Really nice!\n\n:-)\n\n> > diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\n> > index 0392e36d23..04d6c71899 100755\n> > --- a/t/t3406-rebase-message.sh\n> > +++ b/t/t3406-rebase-message.sh\n> > @@ -17,14 +17,9 @@ test_expect_success 'setup' '\n> >       git tag start\n> >  '\n> >\n> > -cat >expect <<\\EOF\n> > -Already applied: 0001 A\n> > -Already applied: 0002 B\n> > -Committed: 0003 Z\n> > -EOF\n> > -\n>\n> As I had mentioned in the previous round: I think we can retain these\n> messages for the `--merge` mode. And I think we should: users of --merge\n> have most likely become to expect them.\n>\n> The most elegant way would probably be by adding code to the sequencer\n> that outputs these lines if in \"merge\" mode (and add a flag to say that we\n> *are* in \"merge\" mode).\n>\n> To that end, the `make_script()` function would not generate `# pick` but\n> `drop` lines, I think, so that the sequencer can see those and print the\n> `Already applied: <message>` lines. And a successful `TODO_PICK` would\n> write out `Committed: <message>`.\n\nI'll take a look, but is this a case where you want it only when\nrebase previously showed them, or should it also affect other cases\nsuch as --rebase-merges or --exec or general --interactive?\n\nI'm hoping the latter, or that there's a good UI-level explanation for\nwhy certain rebase flags would actually mean that users should expect\ndifferent output.  rebase seems to be loaded with cases where slight\nvariations on options yield very different side output and perhaps\neven results mostly based on which backend it historically was\nimplemented on top of.  Those gratuitous inconsistencies drive this\nparticular user crazy.\n\n> >  test_expect_success 'rebase -m' '\n> >       git rebase -m master >report &&\n> > +     >expect &&\n> >       sed -n -e \"/^Already applied: /p\" \\\n> >               -e \"/^Committed: /p\" report >actual &&\n> >       test_cmp expect actual\n> > diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n> > index f355c6825a..49077200c5 100755\n> > --- a/t/t3420-rebase-autostash.sh\n> > +++ b/t/t3420-rebase-autostash.sh\n> > @@ -53,41 +53,6 @@ create_expected_success_interactive () {\n> >       EOF\n> >  }\n> >\n> > -create_expected_success_merge () {\n> > -     cat >expected <<-EOF\n> > -     $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > -     HEAD is now at $(git rev-parse --short feature-branch) third commit\n> > -     First, rewinding head to replay your work on top of it...\n> > -     Merging unrelated-onto-branch with HEAD~1\n> > -     Merging:\n> > -     $(git rev-parse --short unrelated-onto-branch) unrelated commit\n> > -     $(git rev-parse --short feature-branch^) second commit\n> > -     found 1 common ancestor:\n> > -     $(git rev-parse --short feature-branch~2) initial commit\n> > -     [detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> > -      Author: A U Thor <author@example.com>\n> > -      Date: Thu Apr 7 15:14:13 2005 -0700\n> > -      2 files changed, 2 insertions(+)\n> > -      create mode 100644 file1\n> > -      create mode 100644 file2\n> > -     Committed: 0001 second commit\n> > -     Merging unrelated-onto-branch with HEAD~0\n> > -     Merging:\n> > -     $(git rev-parse --short rebased-feature-branch~1) second commit\n> > -     $(git rev-parse --short feature-branch) third commit\n> > -     found 1 common ancestor:\n> > -     $(git rev-parse --short feature-branch~1) second commit\n> > -     [detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> > -      Author: A U Thor <author@example.com>\n> > -      Date: Thu Apr 7 15:15:13 2005 -0700\n> > -      1 file changed, 1 insertion(+)\n> > -      create mode 100644 file3\n> > -     Committed: 0002 third commit\n> > -     All done.\n> > -     Applied autostash.\n> > -     EOF\n> > -}\n> > -\n> >  create_expected_failure_am () {\n> >       cat >expected <<-EOF\n> >       $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > @@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n> >       EOF\n> >  }\n> >\n> > -create_expected_failure_merge () {\n> > -     cat >expected <<-EOF\n> > -     $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > -     HEAD is now at $(git rev-parse --short feature-branch) third commit\n> > -     First, rewinding head to replay your work on top of it...\n> > -     Merging unrelated-onto-branch with HEAD~1\n> > -     Merging:\n> > -     $(git rev-parse --short unrelated-onto-branch) unrelated commit\n> > -     $(git rev-parse --short feature-branch^) second commit\n> > -     found 1 common ancestor:\n> > -     $(git rev-parse --short feature-branch~2) initial commit\n> > -     [detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> > -      Author: A U Thor <author@example.com>\n> > -      Date: Thu Apr 7 15:14:13 2005 -0700\n> > -      2 files changed, 2 insertions(+)\n> > -      create mode 100644 file1\n> > -      create mode 100644 file2\n> > -     Committed: 0001 second commit\n> > -     Merging unrelated-onto-branch with HEAD~0\n> > -     Merging:\n> > -     $(git rev-parse --short rebased-feature-branch~1) second commit\n> > -     $(git rev-parse --short feature-branch) third commit\n> > -     found 1 common ancestor:\n> > -     $(git rev-parse --short feature-branch~1) second commit\n> > -     [detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> > -      Author: A U Thor <author@example.com>\n> > -      Date: Thu Apr 7 15:15:13 2005 -0700\n> > -      1 file changed, 1 insertion(+)\n> > -      create mode 100644 file3\n> > -     Committed: 0002 third commit\n> > -     All done.\n> > -     Applying autostash resulted in conflicts.\n> > -     Your changes are safe in the stash.\n> > -     You can run \"git stash pop\" or \"git stash drop\" at any time.\n> > -     EOF\n> > -}\n> > -\n> >  testrebase () {\n> >       type=$1\n> >       dotest=$2\n> > @@ -177,6 +105,9 @@ testrebase () {\n> >       test_expect_success \"rebase$type --autostash: check output\" '\n> >               test_when_finished git branch -D rebased-feature-branch &&\n> >               suffix=${type#\\ --} && suffix=${suffix:-am} &&\n> > +             if test ${suffix} = \"merge\"; then\n> > +                     suffix=interactive\n> > +             fi &&\n> >               create_expected_success_$suffix &&\n> >               test_i18ncmp expected actual\n> >       '\n> > @@ -274,6 +205,9 @@ testrebase () {\n> >       test_expect_success \"rebase$type: check output with conflicting stash\" '\n> >               test_when_finished git branch -D rebased-feature-branch &&\n> >               suffix=${type#\\ --} && suffix=${suffix:-am} &&\n> > +             if test ${suffix} = \"merge\"; then\n> > +                     suffix=interactive\n> > +             fi &&\n> >               create_expected_failure_$suffix &&\n> >               test_i18ncmp expected actual\n> >       '\n>\n> As I stated earlier, I am uncomfortable with this solution. We change\n> behavior rather noticeably, and the regression test tells us the same. We\n> need to either try to deprecate `git rebase --merge`, or we need to at\n> least attempt to recreate the old behavior with the sequencer.\n\nYes, I understand not wanting to confuse users.  But, serious\nquestion, are you (unintentionally) enforcing that we continue\nconfusing users?  I may be totally misunderstanding you or the problem\nspace -- you know a lot more here than I do -- but to me your comments\nsound like enforcing bug compatibility over correctness.\n\nAs stated in the git-2.19 release notes (relative to my previous series),\n    \"git rebase\" behaved slightly differently depending on which one of\n     the three backends gets used; this has been documented and an\n     effort to make them more uniform has begun.\nIf we aren't trying to make the behavior more uniform and don't have\ngood UI rationale for things being different, then my motivation to\nwork on the affected aspects of rebase plummets.\n\nPerhaps this is attributable to a difference of worldview we have, or\nperhaps I'm just missing something totally obvious.  I'm hoping it's\nthe latter.  But if it helps, here's the angle I viewed it from: These\nregression tests showed us that even when identical operations were\nbeing performed from the user perspective, we got very different\nresults with the only difference being what backend happened to be\nselected (and the backends had significant overlap in the area they\ncould all handle, as evidenced by the same testcase being run with\neach).  That seems to me like pretty obvious proof that one or more\nbackends was buggy.  Said another way, it looks to me like this is\nanother example of regression tests enforcing \"one semi-reasonable\nbehavior\" instead of \"the correct behavior\".\n\n\nI fully admit I don't have good UI rationale for why the output from\nthe interactive backend is correct.  It may not be.  I also don't have\ngood UI rationale for why the output from the traditional merge\nbackend would be correct.  (And it could be that both are wrong.)\nIt'd be better to figure out what is correct and make the code and the\ntests implement and check for that.  However, while I don't know what\ncorrect output to show the user is in these cases, I don't see how\nit's possible that both backends could have previously been correct.\nIf someone could clearly enunciate a reason for different options to\nyield different output, I'd happily go and implement it.  One obvious\nexplanation could be \"--interactive implies user-interactivity, which\nshould thus have different output\" -- but that doesn't explain the\npast because we have several interactive_rebase=implied cases which\nthen should have matched --merge's output rather than --interactive's.\nAbsent any such UI rationale, I'd rather at least make all the\nbackends implement the same semi-reasonable behavior so it's at least\nconsistent.  Then when someone figures out what correct is, they can\nfix it all in one place.\n\nI'm curious to hear if someone has a good reason for which messages\nshould be preferred and when.  I'm also curious if perhaps people\nthink that I'm focusing too much on consistency and not enough on\n\"backward compatibility\".\n\n> > diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\n> > index 99b2aac921..911ef49f70 100755\n> > --- a/t/t3421-rebase-topology-linear.sh\n> > +++ b/t/t3421-rebase-topology-linear.sh\n> > @@ -111,7 +111,7 @@ test_run_rebase () {\n> >       \"\n> >  }\n> >  test_run_rebase success ''\n> > -test_run_rebase failure -m\n> > +test_run_rebase success -m\n> >  test_run_rebase success -i\n> >  test_run_rebase success -p\n> >\n> > @@ -126,7 +126,7 @@ test_run_rebase () {\n> >       \"\n> >  }\n> >  test_run_rebase success ''\n> > -test_run_rebase failure -m\n> > +test_run_rebase success -m\n> >  test_run_rebase success -i\n> >  test_run_rebase success -p\n> >\n> > @@ -141,7 +141,7 @@ test_run_rebase () {\n> >       \"\n> >  }\n> >  test_run_rebase success ''\n> > -test_run_rebase failure -m\n> > +test_run_rebase success -m\n> >  test_run_rebase success -i\n> >  test_run_rebase success -p\n> >\n> > @@ -284,7 +284,7 @@ test_run_rebase () {\n> >       \"\n> >  }\n> >  test_run_rebase success ''\n> > -test_run_rebase failure -m\n> > +test_run_rebase success -m\n> >  test_run_rebase success -i\n> >  test_run_rebase success -p\n> >\n> > @@ -315,7 +315,7 @@ test_run_rebase () {\n> >       \"\n> >  }\n> >  test_run_rebase success ''\n> > -test_run_rebase failure -m\n> > +test_run_rebase success -m\n> >  test_run_rebase success -i\n> >  test_run_rebase failure -p\n> >\n>\n> Nice.\n\n:-)\n\n> > diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n> > index 846f85c27e..cd505c0711 100755\n> > --- a/t/t3425-rebase-topology-merges.sh\n> > +++ b/t/t3425-rebase-topology-merges.sh\n> > @@ -72,7 +72,7 @@ test_run_rebase () {\n> >  }\n> >  #TODO: make order consistent across all flavors of rebase\n> >  test_run_rebase success 'e n o' ''\n> > -test_run_rebase success 'e n o' -m\n> > +test_run_rebase success 'n o e' -m\n> >  test_run_rebase success 'n o e' -i\n> >\n> >  test_run_rebase () {\n> > @@ -89,7 +89,7 @@ test_run_rebase () {\n> >  }\n> >  #TODO: make order consistent across all flavors of rebase\n> >  test_run_rebase success 'd e n o' ''\n> > -test_run_rebase success 'd e n o' -m\n> > +test_run_rebase success 'd n o e' -m\n> >  test_run_rebase success 'd n o e' -i\n> >\n> >  test_run_rebase () {\n> > @@ -106,7 +106,7 @@ test_run_rebase () {\n> >  }\n> >  #TODO: make order consistent across all flavors of rebase\n> >  test_run_rebase success 'd e n o' ''\n> > -test_run_rebase success 'd e n o' -m\n> > +test_run_rebase success 'd n o e' -m\n> >  test_run_rebase success 'd n o e' -i\n> >\n> >  test_expect_success \"rebase -p is no-op in non-linear history\" \"\n>\n> This is a bit unfortunate. I wonder if we could do something like this, to\n> retain the current behavior:\n>\n> -- snip --\n> diff --git a/sequencer.c b/sequencer.c\n> index 9e1ab3a2a7..5018957e49 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -4394,7 +4394,8 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,\n>         revs.reverse = 1;\n>         revs.right_only = 1;\n>         revs.sort_order = REV_SORT_IN_GRAPH_ORDER;\n> -       revs.topo_order = 1;\n> +       if (!(flags & TODO_LIST_NO_TOPO_ORDER))\n> +               revs.topo_order = 1;\n>\n>         revs.pretty_given = 1;\n>         git_config_get_string(\"rebase.instructionFormat\", &format);\n> -- snap -\n>\n> (and then pass TODO_LIST_NO_TOPO_ORDER if in \"merge\" mode)?\n\nOh, sweet, we can make these consistent?  I tried to look at this a\nlittle bit didn't dig too far.  I love it; I'll definitely give it a\ntry.\n\n...but...why only in merge mode??  am, interactive, and merge backends\ngave different results, and the regression test even pointed out that\nwhoever wrote these tests thought it was a bug (the several TODO\ncomments).  You knew where to fix it, but want to match previous\nbehavior instead of fixing the inconsistency?\n\n\n<Snipped a couple things that we already discussed since they were\nbrought up in the commit message>\n\n> Thank you for this pleasant read. I think there is still quite a bit of\n> work to do, but you already did most of it.\n\nThanks for the detailed review and the pointers.  Much appreciated.\nWe may still have a disconnect of some sort (backwards/bug\ncompatibility vs. correctness/consistency), or perhaps I'm just\nmisunderstanding something for part of the review.  However, I can\ndefinitely get to work on the other parts of your review comments, and\nhopefully we can talk through the other bits.\n\n> Out of curiosity, do you have a public repository with these patches in a\n> branch? (I might have an hour to play with it tonight...)\n\nSo, yesterday I pointed you at my rebase-new-default branch, but since\nit has other cruft as well, I just pushed this to a new branch with\njust the stuff in this patch series.  I'll keep it up at\n\nhttps://github.com/newren/git/tree/rebase-merge-on-sequencer\n\n\nThanks!\nElijah\n"},{"id":"363404","messageId":"CABPp-BERm=tCRE_D8nK3Pj2YOss1RKCgt5uL-ojbT7Ph=P8G+Q@mail.gmail.com","threadId":"49781","inReplyTo":"f0231c21-8727-94cb-96aa-13ebfb5b7283@talktalk.net","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-14T23:06:49Z","receivedAt":"2018-11-14T23:07:04Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Phillip,\n\nOn Mon, Nov 12, 2018 at 10:21 AM Phillip Wood <phillip.wood@talktalk.net> wrote:\n> >> -Flags only understood by the am backend:\n> >> +The following options:\n> >>\n> >>   * --committer-date-is-author-date\n> >>   * --ignore-date\n> >> @@ -520,15 +512,12 @@ Flags only understood by the am backend:\n> >>   * --ignore-whitespace\n> >>   * -C\n> >>\n> >> -Flags understood by both merge and interactive backends:\n> >> +are incompatible with the following options:\n> >>\n> >>   * --merge\n> >>   * --strategy\n> >>   * --strategy-option\n> >>   * --allow-empty-message\n> >> -\n> >> -Flags only understood by the interactive backend:\n> >> -\n>\n> It's nice to see this being simplified\n\n:-)\n\n> >> -if test -n \"$git_am_opt\"; then\n> >> -    incompatible_opts=$(echo \" $git_am_opt \" | \\\n> >> -                        sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> >> -    if test -n \"$interactive_rebase\"\n> >> +incompatible_opts=$(echo \" $git_am_opt \" | \\\n> >> +                sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> >\n> > Why are we no longer guarding this behind the condition that the user\n> > specified *any* option intended for the `am` backend?\n>\n> I was confused by this as well, what if the user asks for 'rebase\n> --exec=<cmd> --ignore-whitespace'?\n\nThey'd still get an error message about incompatible options; see my\nemail to Dscho.  However, since it tripped you both up, I'll make the\nclean up here a separate commit with some comments.\n\n> >> +if test -n \"$incompatible_opts\"\n> >> +then\n> >> +    if test -n \"$actually_interactive\" || test \"$do_merge\"\n> >>      then\n> >> -            if test -n \"$incompatible_opts\"\n> >> -            then\n> >> -                    die \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> >> -            fi\n> >> -    fi\n> >> -    if test -n \"$do_merge\"; then\n> >> -            if test -n \"$incompatible_opts\"\n> >> -            then\n> >> -                    die \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> >> -            fi\n> >> +            die \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n> >>      fi\n> >>  fi\n> >>\n>\n> If you want to change the error message here, I think you need to change\n> the corresponding message in builtin/rebase.c\n\nIndeed, will fix.\n"},{"id":"363427","messageId":"nycvar.QRO.7.76.6.1811151233430.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"CABPp-BHgeSGxVe1ThZcX=5Q4wO_-frm59=CwwrJxNRcHXiPTqQ@mail.gmail.com","subject":"Re: [PATCH v2 2/2] rebase: Implement --merge via git-rebase--interactive","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-15T12:27:09Z","receivedAt":"2018-11-15T12:27:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Wed, 14 Nov 2018, Elijah Newren wrote:\n\n> On Mon, Nov 12, 2018 at 8:21 AM Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> > >   t3425: topology linearization was inconsistent across flavors of rebase,\n> > >          as already noted in a TODO comment in the testcase.  This was not\n> > >          considered a bug before, so getting a different linearization due\n> > >          to switching out backends should not be considered a bug now.\n> >\n> > Ideally, the test would be fixed, then. If it fails for other reasons than\n> > a real regression, it is not a very good regression test, is it.\n> \n> I agree, it's not the best regression test.  It'd be better if it\n> defined and tested for \"the correct behavior\", but I suspect it has\n> some value in that it's is guaranteeing that the rebase flavors at\n> least give a \"somewhat reasonable\" result.  Sadly, It just allowed all\n> three rebase types to have slightly different \"somewhat reasonable\"\n> answers.\n\nTrue. I hope, though, that we can address this relatively easily (by\ntoggling the `topo_order` flag).\n\n> > >   t5407: different rebase types varied slightly in how many times checkout\n> > >          or commit or equivalents were called based on a quick comparison\n> > >          of this tests and previous ones which covered different rebase\n> > >          flavors.  I think this is just attributable to this difference.\n> >\n> > This concerns me.\n> >\n> > In bigger repositories (no, I am not talking about Linux kernel sized\n> > ones, I consider those small-ish) there are a ton of files, and checkout\n> > and commit (and even more so reset) sadly do not have a runtime complexity\n> > growing with the number of modified files, but with the number of tracked\n> > files (and some commands even with the number of worktree files).\n> >\n> > So a larger number of commit/checkout operations makes me expect\n> > performance regressions.\n> >\n> > In this light, could you elaborate a bit on the differences you see\n> > between rebase -i and rebase -m?\n> \n> I wrote this comment months ago and don't remember the full details.\n> From the wording and as best I remember, I suspect I was at least\n> partially annoyed by the fact that these and other regression tests\n> for rebase seemed to not be testing for \"correct\" behavior, but\n> \"existing\" behavior.  That wouldn't be so bad, except that existing\n> behavior differed on the exact same test setup for different rebase\n> backends and the differences in behavior were checked and enforced in\n> the regression tests.  So, it became a matter of taste as to how much\n> things should be made identical and to which backend, or whether it\n> was more important to at least just consolidate the code first and\n> keep the results at least reasonable.  At the time, I figured getting\n> fewer backends, all with reasonable behavior was a bit more important,\n> but since this difference is worrisome to you, I will try to dig\n> further into it.\n\nI agree that there is a ton of inconsistency going on, both in the\nbehavior of the different backends as well as in the tests and their\nquality.\n\nThe best explanation I have for this is: it grew historically, and we\nalways have to strike a balance between strict rule enforcement and fun.\n\n> > >   t9903: --merge uses the interactive backend so the prompt expected is\n> > >          now REBASE-i.\n> >\n> > We should be able to make that test pass, still, by writing out a special\n> > file (e.g. $state_dir/opt_m) and testing for that. Users are oddly upset\n> > when their expectations are broken... (and I actually agree with them.)\n> \n> I agree users are upset when expectations are broken, but why would\n> they expect REBASE-m?  In fact, I thought the prompt was a reflection\n> of what backend was in use, so that if someone reported an issue to\n> the git mailing list or a power user wanted to know where the control\n> files were located, they could look for them.  As such, I thought that\n> switching the prompt to REBASE-i was the right thing to do so that it\n> would match user expectations.  Yes, the backend changed; that's part\n> of the release notes.\n\nWhen you put it that way, I have to agree with you.\n\n> Is there documentation somewhere that specifies the meaning of this\n> prompt differently than the expectations I had somehow built up?\n\nI was just looking from my perspective, with my experience: if I was a\nheavy user of `git rebase -m` (I am not), I would stumble over this\nprompt. That's all.\n\nWith your explanation, I agree that this is the best course, though.\n\n> > > diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\n> > > index 3407d835bd..35084f5681 100644\n> > > --- a/Documentation/git-rebase.txt\n> > > +++ b/Documentation/git-rebase.txt\n> > > @@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n> > >  INCOMPATIBLE OPTIONS\n> > >  --------------------\n> > >\n> > > -git-rebase has many flags that are incompatible with each other,\n> > > -predominantly due to the fact that it has three different underlying\n> > > -implementations:\n> > > -\n> > > - * one based on linkgit:git-am[1] (the default)\n> > > - * one based on git-merge-recursive (merge backend)\n> > > - * one based on linkgit:git-cherry-pick[1] (interactive backend)\n> > > -\n> >\n> > Could we retain this part, with `s/three/two/` and `/git-merge/d`? *Maybe*\n> > `s/interactive backend/interactive\\/merge backend/`\n> \n> Removing this was actually a suggestion by Phillip back in June at the\n> end of https://public-inbox.org/git/13ccb4d9-582b-d26b-f595-59cb0b7037ab@talktalk.net/,\n> for the purpose of removing an implementation details that users don't\n> need to know about.  As noted elsewhere in the thread, between you and\n> Phillip, I'll add some comments to the commit message about this.\n\nRight. It is not exactly a democracy over here, but I do agree that both\nof your opinions combined weigh more than my single one. Besides, you have\na good point: the documentation is not so much about being technically\ncorrect, but about being helpful to the users. And the new version is\nprobably more helpful than the old version.\n\n> > > -if test -n \"$git_am_opt\"; then\n> > > -     incompatible_opts=$(echo \" $git_am_opt \" | \\\n> > > -                         sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> > > -     if test -n \"$interactive_rebase\"\n> > > +incompatible_opts=$(echo \" $git_am_opt \" | \\\n> > > +                 sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n> >\n> > Why are we no longer guarding this behind the condition that the user\n> > specified *any* option intended for the `am` backend?\n> \n> The code is still correctly guarding, the diff is just confusing.\n> Sorry about that.  To explain, the code previously was basically:\n> \n> if git_am_opt:\n>   if interactive:\n>     if incompatible_opts:\n>       show_error_about_interactive_and_am_incompatibilities\n>   if rebase-merge:\n>     if incompatible_opts\n>       show_error_about_merge_and_am_incompatibilities\n> \n> which was a triply nested if, and the first (git_am_opt) and third\n> (incompatible_opts) were slightly redundant; the latter being a subset\n> of the former.\n\nAh, that's what I missed! Thank you for your explanation.\n\n> Perhaps I should have done a separate cleanup patch before this that\n> changed it to:\n> \n> if incomptable_opts:\n>   if interactive:\n>     show_error_about_interactive_and_am_incompatibilities\n>   if rebase-merge:\n>     show_error_about_merge_and_am_incompatibilities\n> \n> Before then having this patch coalesce that down to:\n> \n> if incomptable_opts:\n>   if interactive:\n>     show_error_about_incompatible_options\n> \n> Since it tripped up both you and Phillip, I'll add this preliminary\n> cleanup as a separate commit with accompanying explanation in my next\n> re-roll.\n\nThank you, much appreciated.\n\n> > > diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\n> > > index 0392e36d23..04d6c71899 100755\n> > > --- a/t/t3406-rebase-message.sh\n> > > +++ b/t/t3406-rebase-message.sh\n> > > @@ -17,14 +17,9 @@ test_expect_success 'setup' '\n> > >       git tag start\n> > >  '\n> > >\n> > > -cat >expect <<\\EOF\n> > > -Already applied: 0001 A\n> > > -Already applied: 0002 B\n> > > -Committed: 0003 Z\n> > > -EOF\n> > > -\n> >\n> > As I had mentioned in the previous round: I think we can retain these\n> > messages for the `--merge` mode. And I think we should: users of --merge\n> > have most likely become to expect them.\n> >\n> > The most elegant way would probably be by adding code to the sequencer\n> > that outputs these lines if in \"merge\" mode (and add a flag to say that we\n> > *are* in \"merge\" mode).\n> >\n> > To that end, the `make_script()` function would not generate `# pick` but\n> > `drop` lines, I think, so that the sequencer can see those and print the\n> > `Already applied: <message>` lines. And a successful `TODO_PICK` would\n> > write out `Committed: <message>`.\n> \n> I'll take a look, but is this a case where you want it only when\n> rebase previously showed them, or should it also affect other cases\n> such as --rebase-merges or --exec or general --interactive?\n\nOh, I was just interested in retaining the previous behavior. So only for\n--merge, not for -r, --exec or -i.\n\n> I'm hoping the latter, or that there's a good UI-level explanation for\n> why certain rebase flags would actually mean that users should expect\n> different output.\n\nHmm. You are right. This *is* an inconsistency, and insisting on\nperpetuating it is maybe not the best idea.\n\n> rebase seems to be loaded with cases where slight variations on options\n> yield very different side output and perhaps even results mostly based\n> on which backend it historically was implemented on top of.  Those\n> gratuitous inconsistencies drive this particular user crazy.\n\nIf you put it that way, we can sell this change of behavior as an\nimprovement: we are *aligning* the output of `git rebase --merge` with the\noutput of `git rebase --interactive`.\n\nI am starting to like it.\n\n> > >  test_expect_success 'rebase -m' '\n> > >       git rebase -m master >report &&\n> > > +     >expect &&\n> > >       sed -n -e \"/^Already applied: /p\" \\\n> > >               -e \"/^Committed: /p\" report >actual &&\n> > >       test_cmp expect actual\n> > > diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\n> > > index f355c6825a..49077200c5 100755\n> > > --- a/t/t3420-rebase-autostash.sh\n> > > +++ b/t/t3420-rebase-autostash.sh\n> > > @@ -53,41 +53,6 @@ create_expected_success_interactive () {\n> > >       EOF\n> > >  }\n> > >\n> > > -create_expected_success_merge () {\n> > > -     cat >expected <<-EOF\n> > > -     $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > > -     HEAD is now at $(git rev-parse --short feature-branch) third commit\n> > > -     First, rewinding head to replay your work on top of it...\n> > > -     Merging unrelated-onto-branch with HEAD~1\n> > > -     Merging:\n> > > -     $(git rev-parse --short unrelated-onto-branch) unrelated commit\n> > > -     $(git rev-parse --short feature-branch^) second commit\n> > > -     found 1 common ancestor:\n> > > -     $(git rev-parse --short feature-branch~2) initial commit\n> > > -     [detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> > > -      Author: A U Thor <author@example.com>\n> > > -      Date: Thu Apr 7 15:14:13 2005 -0700\n> > > -      2 files changed, 2 insertions(+)\n> > > -      create mode 100644 file1\n> > > -      create mode 100644 file2\n> > > -     Committed: 0001 second commit\n> > > -     Merging unrelated-onto-branch with HEAD~0\n> > > -     Merging:\n> > > -     $(git rev-parse --short rebased-feature-branch~1) second commit\n> > > -     $(git rev-parse --short feature-branch) third commit\n> > > -     found 1 common ancestor:\n> > > -     $(git rev-parse --short feature-branch~1) second commit\n> > > -     [detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> > > -      Author: A U Thor <author@example.com>\n> > > -      Date: Thu Apr 7 15:15:13 2005 -0700\n> > > -      1 file changed, 1 insertion(+)\n> > > -      create mode 100644 file3\n> > > -     Committed: 0002 third commit\n> > > -     All done.\n> > > -     Applied autostash.\n> > > -     EOF\n> > > -}\n> > > -\n> > >  create_expected_failure_am () {\n> > >       cat >expected <<-EOF\n> > >       $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > > @@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n> > >       EOF\n> > >  }\n> > >\n> > > -create_expected_failure_merge () {\n> > > -     cat >expected <<-EOF\n> > > -     $(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n> > > -     HEAD is now at $(git rev-parse --short feature-branch) third commit\n> > > -     First, rewinding head to replay your work on top of it...\n> > > -     Merging unrelated-onto-branch with HEAD~1\n> > > -     Merging:\n> > > -     $(git rev-parse --short unrelated-onto-branch) unrelated commit\n> > > -     $(git rev-parse --short feature-branch^) second commit\n> > > -     found 1 common ancestor:\n> > > -     $(git rev-parse --short feature-branch~2) initial commit\n> > > -     [detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n> > > -      Author: A U Thor <author@example.com>\n> > > -      Date: Thu Apr 7 15:14:13 2005 -0700\n> > > -      2 files changed, 2 insertions(+)\n> > > -      create mode 100644 file1\n> > > -      create mode 100644 file2\n> > > -     Committed: 0001 second commit\n> > > -     Merging unrelated-onto-branch with HEAD~0\n> > > -     Merging:\n> > > -     $(git rev-parse --short rebased-feature-branch~1) second commit\n> > > -     $(git rev-parse --short feature-branch) third commit\n> > > -     found 1 common ancestor:\n> > > -     $(git rev-parse --short feature-branch~1) second commit\n> > > -     [detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n> > > -      Author: A U Thor <author@example.com>\n> > > -      Date: Thu Apr 7 15:15:13 2005 -0700\n> > > -      1 file changed, 1 insertion(+)\n> > > -      create mode 100644 file3\n> > > -     Committed: 0002 third commit\n> > > -     All done.\n> > > -     Applying autostash resulted in conflicts.\n> > > -     Your changes are safe in the stash.\n> > > -     You can run \"git stash pop\" or \"git stash drop\" at any time.\n> > > -     EOF\n> > > -}\n> > > -\n> > >  testrebase () {\n> > >       type=$1\n> > >       dotest=$2\n> > > @@ -177,6 +105,9 @@ testrebase () {\n> > >       test_expect_success \"rebase$type --autostash: check output\" '\n> > >               test_when_finished git branch -D rebased-feature-branch &&\n> > >               suffix=${type#\\ --} && suffix=${suffix:-am} &&\n> > > +             if test ${suffix} = \"merge\"; then\n> > > +                     suffix=interactive\n> > > +             fi &&\n> > >               create_expected_success_$suffix &&\n> > >               test_i18ncmp expected actual\n> > >       '\n> > > @@ -274,6 +205,9 @@ testrebase () {\n> > >       test_expect_success \"rebase$type: check output with conflicting stash\" '\n> > >               test_when_finished git branch -D rebased-feature-branch &&\n> > >               suffix=${type#\\ --} && suffix=${suffix:-am} &&\n> > > +             if test ${suffix} = \"merge\"; then\n> > > +                     suffix=interactive\n> > > +             fi &&\n> > >               create_expected_failure_$suffix &&\n> > >               test_i18ncmp expected actual\n> > >       '\n> >\n> > As I stated earlier, I am uncomfortable with this solution. We change\n> > behavior rather noticeably, and the regression test tells us the same. We\n> > need to either try to deprecate `git rebase --merge`, or we need to at\n> > least attempt to recreate the old behavior with the sequencer.\n> \n> Yes, I understand not wanting to confuse users.  But, serious\n> question, are you (unintentionally) enforcing that we continue\n> confusing users?  I may be totally misunderstanding you or the problem\n> space -- you know a lot more here than I do -- but to me your comments\n> sound like enforcing bug compatibility over correctness.\n\nI am actually a really inappropriate person to make judgement calls on\n`git rebase --merge`, as I am neither a user of it nor do I know of any. I\ndon't think I ever read any account of a Git for Windows user who called\n`git rebase --merge`...\n\n> As stated in the git-2.19 release notes (relative to my previous series),\n>     \"git rebase\" behaved slightly differently depending on which one of\n>      the three backends gets used; this has been documented and an\n>      effort to make them more uniform has begun.\n> If we aren't trying to make the behavior more uniform and don't have\n> good UI rationale for things being different, then my motivation to\n> work on the affected aspects of rebase plummets.\n> \n> Perhaps this is attributable to a difference of worldview we have, or\n> perhaps I'm just missing something totally obvious.  I'm hoping it's\n> the latter.  But if it helps, here's the angle I viewed it from: These\n> regression tests showed us that even when identical operations were\n> being performed from the user perspective, we got very different\n> results with the only difference being what backend happened to be\n> selected (and the backends had significant overlap in the area they\n> could all handle, as evidenced by the same testcase being run with\n> each).  That seems to me like pretty obvious proof that one or more\n> backends was buggy.  Said another way, it looks to me like this is\n> another example of regression tests enforcing \"one semi-reasonable\n> behavior\" instead of \"the correct behavior\".\n> \n> \n> I fully admit I don't have good UI rationale for why the output from\n> the interactive backend is correct.  It may not be.  I also don't have\n> good UI rationale for why the output from the traditional merge\n> backend would be correct.  (And it could be that both are wrong.)\n> It'd be better to figure out what is correct and make the code and the\n> tests implement and check for that.  However, while I don't know what\n> correct output to show the user is in these cases, I don't see how\n> it's possible that both backends could have previously been correct.\n> If someone could clearly enunciate a reason for different options to\n> yield different output, I'd happily go and implement it.  One obvious\n> explanation could be \"--interactive implies user-interactivity, which\n> should thus have different output\" -- but that doesn't explain the\n> past because we have several interactive_rebase=implied cases which\n> then should have matched --merge's output rather than --interactive's.\n> Absent any such UI rationale, I'd rather at least make all the\n> backends implement the same semi-reasonable behavior so it's at least\n> consistent.  Then when someone figures out what correct is, they can\n> fix it all in one place.\n> \n> I'm curious to hear if someone has a good reason for which messages\n> should be preferred and when.  I'm also curious if perhaps people\n> think that I'm focusing too much on consistency and not enough on\n> \"backward compatibility\".\n\nIt is good to have your perspective in addition to mine. As na open source\nmaintainer, I gravitate toward aiming for maximal backwards-compatibility\nout of purely selfish reasons: I don't want to deal with so many people\ncomplaining about changes in the software I maintain.\n\nBut you raised a good point: relying on behavior no matter how undesirable\nsaid behavior is not doing users a big favor. It is better to face the\nchallenge of fixing that behavior.\n\n> > > diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n> > > index 846f85c27e..cd505c0711 100755\n> > > --- a/t/t3425-rebase-topology-merges.sh\n> > > +++ b/t/t3425-rebase-topology-merges.sh\n> > > @@ -72,7 +72,7 @@ test_run_rebase () {\n> > >  }\n> > >  #TODO: make order consistent across all flavors of rebase\n> > >  test_run_rebase success 'e n o' ''\n> > > -test_run_rebase success 'e n o' -m\n> > > +test_run_rebase success 'n o e' -m\n> > >  test_run_rebase success 'n o e' -i\n> > >\n> > >  test_run_rebase () {\n> > > @@ -89,7 +89,7 @@ test_run_rebase () {\n> > >  }\n> > >  #TODO: make order consistent across all flavors of rebase\n> > >  test_run_rebase success 'd e n o' ''\n> > > -test_run_rebase success 'd e n o' -m\n> > > +test_run_rebase success 'd n o e' -m\n> > >  test_run_rebase success 'd n o e' -i\n> > >\n> > >  test_run_rebase () {\n> > > @@ -106,7 +106,7 @@ test_run_rebase () {\n> > >  }\n> > >  #TODO: make order consistent across all flavors of rebase\n> > >  test_run_rebase success 'd e n o' ''\n> > > -test_run_rebase success 'd e n o' -m\n> > > +test_run_rebase success 'd n o e' -m\n> > >  test_run_rebase success 'd n o e' -i\n> > >\n> > >  test_expect_success \"rebase -p is no-op in non-linear history\" \"\n> >\n> > This is a bit unfortunate. I wonder if we could do something like this, to\n> > retain the current behavior:\n> >\n> > -- snip --\n> > diff --git a/sequencer.c b/sequencer.c\n> > index 9e1ab3a2a7..5018957e49 100644\n> > --- a/sequencer.c\n> > +++ b/sequencer.c\n> > @@ -4394,7 +4394,8 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,\n> >         revs.reverse = 1;\n> >         revs.right_only = 1;\n> >         revs.sort_order = REV_SORT_IN_GRAPH_ORDER;\n> > -       revs.topo_order = 1;\n> > +       if (!(flags & TODO_LIST_NO_TOPO_ORDER))\n> > +               revs.topo_order = 1;\n> >\n> >         revs.pretty_given = 1;\n> >         git_config_get_string(\"rebase.instructionFormat\", &format);\n> > -- snap -\n> >\n> > (and then pass TODO_LIST_NO_TOPO_ORDER if in \"merge\" mode)?\n> \n> Oh, sweet, we can make these consistent?  I tried to look at this a\n> little bit didn't dig too far.  I love it; I'll definitely give it a\n> try.\n> \n> ...but...why only in merge mode??  am, interactive, and merge backends\n> gave different results, and the regression test even pointed out that\n> whoever wrote these tests thought it was a bug (the several TODO\n> comments).  You knew where to fix it, but want to match previous\n> behavior instead of fixing the inconsistency?\n\nI am afraid that we *have* to use topo_order for -r, but you know, I could\nbe convinced that it is a good idea to switch away from topo order for\nregular -i.\n\n> <Snipped a couple things that we already discussed since they were\n> brought up in the commit message>\n> \n> > Thank you for this pleasant read. I think there is still quite a bit of\n> > work to do, but you already did most of it.\n> \n> Thanks for the detailed review and the pointers.  Much appreciated.\n> We may still have a disconnect of some sort (backwards/bug\n> compatibility vs. correctness/consistency), or perhaps I'm just\n> misunderstanding something for part of the review.  However, I can\n> definitely get to work on the other parts of your review comments, and\n> hopefully we can talk through the other bits.\n\nI think it will get easier when other people chime in, so that we do not\ngo back and forth between our two opinions but instead get a broader\ncontext in which to make decisions, so that we will hopefully end up with\na fine balance between consistency/correctness and\nbackwards-compatibility.\n\n> > Out of curiosity, do you have a public repository with these patches in a\n> > branch? (I might have an hour to play with it tonight...)\n> \n> So, yesterday I pointed you at my rebase-new-default branch, but since\n> it has other cruft as well, I just pushed this to a new branch with\n> just the stuff in this patch series.  I'll keep it up at\n> \n> https://github.com/newren/git/tree/rebase-merge-on-sequencer\n\nThank you!\n\nI had originally planned on seeing how difficult it would be to reinstate\nthose messages of `rebase -m`, but in the meantime I get the impression\nthat I may not even want those to survive the merge of the --merge mode\ninto --interactive.\n\nCiao,\nDscho\n"},{"id":"363863","messageId":"20181122044841.20993-5-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 4/7] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:38Z","receivedAt":"2018-11-22T04:48:53Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"While 'quiet' and 'interactive' may sound like antonyms, the interactive\nmachinery actually has logic that implements several\ninteractive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\nwhich won't pop up an editor.  The rewrite of interactive rebase in C\nadded a quiet option, though it only turns stats off.  Since we want to\nmake the interactive machinery also take over for git-rebase--merge, it\nshould fully implement the --quiet option.\n\ngit-rebase--interactive was already somewhat quieter than\ngit-rebase--merge and git-rebase--am, possibly because cherry-pick has\njust traditionally been quieter.  As such, we only drop a few\ninformational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n\nAlso, for simplicity, remove the differences in how quiet and verbose\noptions were recorded.  Having one be signalled by the presence of a\n\"verbose\" file in the state_dir, while the other was signalled by the\ncontents of a \"quiet\" file was just weirdly inconsistent.  (This\ninconsistency pre-dated the rewrite into C.)  Make them consistent by\nhaving them both key off the presence of the file.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c      |  5 +----\n git-legacy-rebase.sh  |  2 +-\n git-rebase--common.sh |  2 +-\n sequencer.c           | 23 +++++++++++++----------\n sequencer.h           |  1 +\n 5 files changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 5ece134ae6..f1f449801b 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n \tif (get_oid(buf.buf, &opts->orig_head))\n \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n \n-\tstrbuf_reset(&buf);\n-\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n-\t\treturn -1;\n-\tif (buf.len)\n+\tif (file_exists(state_dir_path(\"quiet\", opts)))\n \t\topts->flags &= ~REBASE_NO_QUIET;\n \telse\n \t\topts->flags |= REBASE_NO_QUIET;\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 0a747eb76c..d01eef9876 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -113,7 +113,7 @@ read_basic_state () {\n \telse\n \t\torig_head=$(cat \"$state_dir\"/head)\n \tfi &&\n-\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n+\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n \ttest -f \"$state_dir\"/verbose && verbose=t\n \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n \ttest -f \"$state_dir\"/strategy_opts &&\ndiff --git a/git-rebase--common.sh b/git-rebase--common.sh\nindex 7e39d22871..dc18c682fa 100644\n--- a/git-rebase--common.sh\n+++ b/git-rebase--common.sh\n@@ -10,7 +10,7 @@ write_basic_state () {\n \techo \"$head_name\" > \"$state_dir\"/head-name &&\n \techo \"$onto\" > \"$state_dir\"/onto &&\n \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n-\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n+\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\ndiff --git a/sequencer.c b/sequencer.c\nindex e1a4dd15f1..bc25615050 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n+static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n@@ -157,7 +158,6 @@ 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-static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n \n static int git_sequencer_config(const char *k, const char *v, void *cb)\n {\n@@ -2357,6 +2357,9 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\tif (file_exists(rebase_path_verbose()))\n \t\t\topts->verbose = 1;\n \n+\t\tif (file_exists(rebase_path_quiet()))\n+\t\t\topts->quiet = 1;\n+\n \t\tif (file_exists(rebase_path_signoff())) {\n \t\t\topts->allow_ff = 0;\n \t\t\topts->signoff = 1;\n@@ -2424,9 +2427,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n \n \tif (quiet)\n \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n-\telse\n-\t\twrite_file(rebase_path_quiet(), \"\\n\");\n-\n \tif (opts->verbose)\n \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n \tif (opts->strategy)\n@@ -3503,10 +3503,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n \t\t\t\t\tfclose(f);\n \t\t\t\t}\n-\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n-\t\t\t\t\ttodo_list->done_nr,\n-\t\t\t\t\ttodo_list->total_nr,\n-\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n+\t\t\t\tif (!opts->quiet)\n+\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n+\t\t\t\t\t\ttodo_list->done_nr,\n+\t\t\t\t\t\ttodo_list->total_nr,\n+\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n \t\t\t}\n \t\t\tunlink(rebase_path_message());\n \t\t\tunlink(rebase_path_author_script());\n@@ -3738,8 +3739,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t}\n \t\tapply_autostash(opts);\n \n-\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n-\t\t\thead_ref.buf);\n+\t\tif (!opts->quiet)\n+\t\t\tfprintf(stderr,\n+\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n+\t\t\t\thead_ref.buf);\n \n \t\tstrbuf_release(&buf);\n \t\tstrbuf_release(&head_ref);\ndiff --git a/sequencer.h b/sequencer.h\nindex 5071a73563..729222b583 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -39,6 +39,7 @@ struct replay_opts {\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n \tint verbose;\n+\tint quiet;\n \n \tint mainline;\n \n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363864","messageId":"20181122044841.20993-3-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 2/7] t5407: add a test demonstrating how interactive handles --skip differently","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:36Z","receivedAt":"2018-11-22T04:48:55Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is documented as being invoked by commands that\nrewrite commits such as commit --amend and rebase, and that it will\nbe called for each rewritten commit.\n\nApparently, the three backends handled --skip'ed commits differently:\n  am: treat the skipped commit as though it weren't rewritten\n  merge: same as 'am' backend\n  interactive: treat skipped commits as having been rewritten to empty\n     (view them as an empty fixup to their parent)\n\nFor now, just add a testcase documenting the different behavior (use\n--keep to force usage of the interactive machinery even though we have\nno empty commits).  A subsequent commit will remove the inconsistency in\n--skip handling.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n t/t5407-post-rewrite-hook.sh | 31 +++++++++++++++++++++++++++++++\n 1 file changed, 31 insertions(+)\n\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 9b2a274c71..6426ec8991 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '\n \tverify_hook_input\n '\n \n+test_expect_success 'git rebase with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\techo C > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n+test_expect_success 'git rebase --skip with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\ttest_must_fail git rebase --skip &&\n+\techo D > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n set_fake_editor\n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363865","messageId":"20181122044841.20993-2-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 1/7] rebase: fix incompatible options error message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:35Z","receivedAt":"2018-11-22T04:48:55Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"In commit f57696802c30 (\"rebase: really just passthru the `git am`\noptions\", 2018-11-14), the handling of `git am` options was simplified\ndramatically (and an option parsing bug was fixed), but it introduced\na small regression in the error message shown when options only\nunderstood by separate backends were used:\n\n$ git rebase --keep --ignore-whitespace\nfatal: error: cannot combine interactive options (--interactive, --exec,\n--rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\nam options (.git/rebase-apply/applying)\n\n$ git rebase --merge --ignore-whitespace\nfatal: error: cannot combine merge options (--merge, --strategy,\n--strategy-option) with am options (.git/rebase-apply/applying)\n\nNote that in both cases, the list of \"am options\" is\n\".git/rebase-apply/applying\", which makes no sense.  Since the lists of\nbackend-specific options is documented pretty thoroughly in the rebase\nman page (in the \"Incompatible Options\" section, with multiple links\nthroughout the document), and since I expect this list to change over\ntime, just simplify the error message.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c     | 11 ++++-------\n git-legacy-rebase.sh |  4 ++--\n 2 files changed, 6 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 5b3e5baec8..5ece134ae6 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1202,14 +1202,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine interactive options \"\n-\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n-\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n-\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n+\t\t\tdie(_(\"error: cannot combine am options \"\n+\t\t\t      \"with interactive options\"));\n \t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n-\t\t\t      \"--strategy, --strategy-option) with am options \"\n-\t\t\t      \"(%s)\"), buf.buf);\n+\t\t\tdie(_(\"error: cannot combine am options \"\n+\t\t\t      \"with merge options \"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex b97ffdc9dd..0a747eb76c 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n \tthen\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n \t\tfi\n \tfi\n \tif test -n \"$do_merge\"; then\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n \t\tfi\n \tfi\n fi\n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363866","messageId":"20181122044841.20993-1-newren@gmail.com","threadId":"49781","inReplyTo":"20181108060158.27145-1-newren@gmail.com","subject":"[PATCH v3 0/7] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:34Z","receivedAt":"2018-11-22T04:48:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"[Important: Patch 1 fixes a (minor) regression in 2.20 relative to\n2.19...but it also modifies a translated string.  I'm not sure what the\nright step we want to take there is.  If you want me to submit it\nseparately and also resubmit the rest of this series to depend on the\nseparated first patch, let me know.]\n\nThis series continues the work of making rebase more self-consistent\nby removing inconsistencies between different backends.  In\nparticular, this series focuses on making the merge machinery behave\nlike the interactive machinery (though two differences between the am\nand interactive backends are also fixed along the way), and ultimately\nremoves the merge backend in favor of reimplementing the relevant\noptions on top of the interactive machinery.\n\nDifferences since v2 (full range-diff below):\n  - Addressed feedback from both Phillip and Dscho\n  - Added five new patches; the biggest change is still the final patch\n    but it should be a little easier to review now.\n  - Added a patch fixing a very recent regression in the incompatible\n    options error message\n  - Documented and fixed the inconsistency in how different rebase backends\n    handle --skip relative to the post-rewrite hook\n  - Added a patch defining the linearization order and enforcing it,\n    getting rid of an age-old TODO\n  - Added a patch which took a slightly confusing diff hunk from the\n    previous final patch, and give it its own commit message explaining\n    why the drop from a triply-nested if block to a doubly-nested\n    if-block still keeps all necessary checks in place.\n  - Rebased to latest master\n\nElijah Newren (7):\n  rebase: fix incompatible options error message\n  t5407: add a test demonstrating how interactive handles --skip\n    differently\n  am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n  git-rebase, sequencer: extend --quiet option for the interactive\n    machinery\n  git-legacy-rebase: simplify unnecessary triply-nested if\n  rebase: define linearization ordering and enforce it\n  rebase: Implement --merge via the interactive machinery\n\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +---\n Makefile                          |   1 -\n builtin/am.c                      |   9 ++\n builtin/rebase.c                  |  24 ++---\n git-legacy-rebase.sh              |  57 +++++------\n git-rebase--am.sh                 |   2 +-\n git-rebase--common.sh             |   2 +-\n git-rebase--merge.sh              | 164 ------------------------------\n sequencer.c                       |  23 +++--\n sequencer.h                       |   1 +\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t3425-rebase-topology-merges.sh |  15 ++-\n t/t5407-post-rewrite-hook.sh      |  34 +++++++\n t/t9903-bash-prompt.sh            |   2 +-\n 17 files changed, 114 insertions(+), 333 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\n-:  ---------- > 1:  2f4bdd1980 rebase: fix incompatible options error message\n-:  ---------- > 2:  cc33a8ccc1 t5407: add a test demonstrating how interactive handles --skip differently\n-:  ---------- > 3:  f5838ef763 am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n1:  bf0acd9b27 ! 4:  50dc863d9f git-rebase, sequencer: extend --quiet option for the interactive machinery\n    @@ -13,7 +13,7 @@\n         git-rebase--interactive was already somewhat quieter than\n         git-rebase--merge and git-rebase--am, possibly because cherry-pick has\n         just traditionally been quieter.  As such, we only drop a few\n    -    informational messages -- \"Rebasing (n/m)\" and \"Succesfully rebased...\"\n    +    informational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n     \n         Also, for simplicity, remove the differences in how quiet and verbose\n         options were recorded.  Having one be signalled by the presence of a\n-:  ---------- > 5:  35cf552f27 git-legacy-rebase: simplify unnecessary triply-nested if\n-:  ---------- > 6:  2a3d8ff1c1 rebase: define linearization ordering and enforce it\n2:  cd0ccab680 ! 7:  58371d377a rebase: Implement --merge via git-rebase--interactive\n    @@ -1,35 +1,37 @@\n     Author: Elijah Newren <newren@gmail.com>\n     \n    -    rebase: Implement --merge via git-rebase--interactive\n    +    rebase: Implement --merge via the interactive machinery\n     \n    -    Interactive rebases are implemented in terms of cherry-pick rather than\n    -    the merge-recursive builtin, but cherry-pick also calls into the recursive\n    -    merge machinery by default and can accept special merge strategies and/or\n    -    special strategy options.  As such, there really is not any need for\n    -    having both git-rebase--merge and git-rebase--interactive anymore.\n    +    As part of an ongoing effort to make rebase have more uniform behavior,\n    +    modify the merge backend to behave like the interactive one, by\n    +    re-implementing it on top of the latter.\n     \n    -    Delete git-rebase--merge.sh and have the --merge option be implemented\n    -    by the now built-in interactive machinery.\n    +    Interactive rebases are implemented in terms of cherry-pick rather than\n    +    the merge-recursive builtin, but cherry-pick also calls into the\n    +    recursive merge machinery by default and can accept special merge\n    +    strategies and/or special strategy options.  As such, there really is\n    +    not any need for having both git-rebase--merge and\n    +    git-rebase--interactive anymore.  Delete git-rebase--merge.sh and\n    +    instead implement it in builtin/rebase.c.\n     \n    -    Note that this change fixes a few known test failures (see t3421).\n    +    This results in a few deliberate but small user-visible changes:\n    +      * The progress output is modified (see t3406 and t3420 for examples)\n    +      * A few known test failures are now fixed (see t3421)\n    +      * bash-prompt during a rebase --merge is now REBASE-i instead of\n    +        REBASE-m.  Reason: The prompt is a reflection of the backend in use;\n    +        this allows users to report an issue to the git mailing list with\n    +        the appropriate backend information, and allows advanced users to\n    +        know where to search for relevant control files.  (see t9903)\n     \n         testcase modification notes:\n           t3406: --interactive and --merge had slightly different progress output\n    -             while running; adjust a test to match\n    +             while running; adjust a test to match the new expectation\n           t3420: these test precise output while running, but rebase--am,\n                  rebase--merge, and rebase--interactive all were built on very\n                  different commands (am, merge-recursive, cherry-pick), so the\n                  tests expected different output for each type.  Now we expect\n                  --merge and --interactive to have the same output.\n           t3421: --interactive fixes some bugs in --merge!  Wahoo!\n    -      t3425: topology linearization was inconsistent across flavors of rebase,\n    -             as already noted in a TODO comment in the testcase.  This was not\n    -             considered a bug before, so getting a different linearization due\n    -             to switching out backends should not be considered a bug now.\n    -      t5407: different rebase types varied slightly in how many times checkout\n    -             or commit or equivalents were called based on a quick comparison\n    -             of this tests and previous ones which covered different rebase\n    -             flavors.  I think this is just attributable to this difference.\n           t9903: --merge uses the interactive backend so the prompt expected is\n                  now REBASE-i.\n     \n    @@ -133,13 +135,24 @@\n      \t\t}\n      \t}\n      \n    -+\tif (options.type == REBASE_MERGE) {\n    ++\tif (options.type == REBASE_MERGE)\n     +\t\timply_interactive(&options, \"--merge\");\n    -+\t}\n     +\n      \tif (options.root && !options.onto_name)\n      \t\timply_interactive(&options, \"--root without --onto\");\n      \n    +@@\n    + \n    + \t\tif (is_interactive(&options) && i >= 0)\n    + \t\t\tdie(_(\"error: cannot combine am options \"\n    +-\t\t\t      \"with interactive options\"));\n    +-\t\tif (options.type == REBASE_MERGE && i >= 0)\n    +-\t\t\tdie(_(\"error: cannot combine am options \"\n    +-\t\t\t      \"with merge options \"));\n    ++\t\t\t      \"with either interactive or merge options\"));\n    + \t}\n    + \n    + \tif (options.signoff) {\n     \n      diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n      --- a/git-legacy-rebase.sh\n    @@ -187,30 +200,18 @@\n      else\n      \ttype=am\n     @@\n    - \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n    - fi\n    - \n    --if test -n \"$git_am_opt\"; then\n    --\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n    --\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n    + \t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n    + if test -n \"$incompatible_opts\"\n    + then\n     -\tif test -n \"$interactive_rebase\"\n    -+incompatible_opts=$(echo \" $git_am_opt \" | \\\n    -+\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n    -+if test -n \"$incompatible_opts\"\n    -+then\n    +-\tthen\n    +-\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n    +-\tfi\n    +-\tif test -n \"$do_merge\"\n     +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n      \tthen\n    --\t\tif test -n \"$incompatible_opts\"\n    --\t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n    --\t\tfi\n    --\tfi\n    --\tif test -n \"$do_merge\"; then\n    --\t\tif test -n \"$incompatible_opts\"\n    --\t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n    --\t\tfi\n    -+\t\tdie \"$(gettext \"error: cannot combine am options ($incompatible_opts) with either interactive or merge options\")\"\n    +-\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n    ++\t\tdie \"$(gettext \"error: cannot combine am options with either interactive or merge options\")\"\n      \tfi\n      fi\n      \n    @@ -229,11 +230,11 @@\n      \n     +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n     +then\n    -+\t# If the $onto is a proper descendant of the tip of the branch, then\n    -+\t# we just fast-forwarded.\n     +\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n     +\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n     +\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n    ++\t# If the $onto is a proper descendant of the tip of the branch, then\n    ++\t# we just fast-forwarded.\n     +\tgit update-ref ORIG_HEAD $orig_head\n     +\tmove_to_original_branch\n     +\tfinish_rebase\n    @@ -389,6 +390,8 @@\n     -skip)\n     -\tread_state\n     -\tgit rerere clear\n    +-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n    +-\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n     -\tmsgnum=$(($msgnum + 1))\n     -\twhile test \"$msgnum\" -le \"$end\"\n     -\tdo\n    @@ -409,7 +412,7 @@\n     -rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n     -\n     -msgnum=0\n    --for cmt in $(git rev-list --reverse --no-merges \"$revisions\")\n    +-for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n     -do\n     -\tmsgnum=$(($msgnum + 1))\n     -\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n    @@ -571,7 +574,7 @@\n     -test_run_rebase failure -m\n     +test_run_rebase success -m\n      test_run_rebase success -i\n    - test_run_rebase success -p\n    + test_have_prereq !REBASE_P || test_run_rebase success -p\n      \n     @@\n      \t\"\n    @@ -580,7 +583,7 @@\n     -test_run_rebase failure -m\n     +test_run_rebase success -m\n      test_run_rebase success -i\n    - test_run_rebase success -p\n    + test_have_prereq !REBASE_P || test_run_rebase success -p\n      \n     @@\n      \t\"\n    @@ -589,7 +592,7 @@\n     -test_run_rebase failure -m\n     +test_run_rebase success -m\n      test_run_rebase success -i\n    - test_run_rebase success -p\n    + test_have_prereq !REBASE_P || test_run_rebase success -p\n      \n     @@\n      \t\"\n    @@ -598,7 +601,7 @@\n     -test_run_rebase failure -m\n     +test_run_rebase success -m\n      test_run_rebase success -i\n    - test_run_rebase success -p\n    + test_have_prereq !REBASE_P || test_run_rebase success -p\n      \n     @@\n      \t\"\n    @@ -607,52 +610,9 @@\n     -test_run_rebase failure -m\n     +test_run_rebase success -m\n      test_run_rebase success -i\n    - test_run_rebase failure -p\n    + test_have_prereq !REBASE_P || test_run_rebase failure -p\n      \n     \n    - diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\n    - --- a/t/t3425-rebase-topology-merges.sh\n    - +++ b/t/t3425-rebase-topology-merges.sh\n    -@@\n    - }\n    - #TODO: make order consistent across all flavors of rebase\n    - test_run_rebase success 'e n o' ''\n    --test_run_rebase success 'e n o' -m\n    -+test_run_rebase success 'n o e' -m\n    - test_run_rebase success 'n o e' -i\n    - \n    - test_run_rebase () {\n    -@@\n    - }\n    - #TODO: make order consistent across all flavors of rebase\n    - test_run_rebase success 'd e n o' ''\n    --test_run_rebase success 'd e n o' -m\n    -+test_run_rebase success 'd n o e' -m\n    - test_run_rebase success 'd n o e' -i\n    - \n    - test_run_rebase () {\n    -@@\n    - }\n    - #TODO: make order consistent across all flavors of rebase\n    - test_run_rebase success 'd e n o' ''\n    --test_run_rebase success 'd e n o' -m\n    -+test_run_rebase success 'd n o e' -m\n    - test_run_rebase success 'd n o e' -i\n    - \n    - test_expect_success \"rebase -p is no-op in non-linear history\" \"\n    -\n    - diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\n    - --- a/t/t5407-post-rewrite-hook.sh\n    - +++ b/t/t5407-post-rewrite-hook.sh\n    -@@\n    - \tgit rebase --continue &&\n    - \techo rebase >expected.args &&\n    - \tcat >expected.data <<-EOF &&\n    -+\t$(git rev-parse C) $(git rev-parse HEAD^)\n    - \t$(git rev-parse D) $(git rev-parse HEAD)\n    - \tEOF\n    - \tverify_hook_input\n    -\n      diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n      --- a/t/t9903-bash-prompt.sh\n      +++ b/t/t9903-bash-prompt.sh\n\n-- \n2.20.0.rc1.7.g58371d377a\n"},{"id":"363867","messageId":"20181122044841.20993-8-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 7/7] rebase: Implement --merge via the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:41Z","receivedAt":"2018-11-22T04:48:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"As part of an ongoing effort to make rebase have more uniform behavior,\nmodify the merge backend to behave like the interactive one, by\nre-implementing it on top of the latter.\n\nInteractive rebases are implemented in terms of cherry-pick rather than\nthe merge-recursive builtin, but cherry-pick also calls into the\nrecursive merge machinery by default and can accept special merge\nstrategies and/or special strategy options.  As such, there really is\nnot any need for having both git-rebase--merge and\ngit-rebase--interactive anymore.  Delete git-rebase--merge.sh and\ninstead implement it in builtin/rebase.c.\n\nThis results in a few deliberate but small user-visible changes:\n  * The progress output is modified (see t3406 and t3420 for examples)\n  * A few known test failures are now fixed (see t3421)\n  * bash-prompt during a rebase --merge is now REBASE-i instead of\n    REBASE-m.  Reason: The prompt is a reflection of the backend in use;\n    this allows users to report an issue to the git mailing list with\n    the appropriate backend information, and allows advanced users to\n    know where to search for relevant control files.  (see t9903)\n\ntestcase modification notes:\n  t3406: --interactive and --merge had slightly different progress output\n         while running; adjust a test to match the new expectation\n  t3420: these test precise output while running, but rebase--am,\n         rebase--merge, and rebase--interactive all were built on very\n         different commands (am, merge-recursive, cherry-pick), so the\n         tests expected different output for each type.  Now we expect\n         --merge and --interactive to have the same output.\n  t3421: --interactive fixes some bugs in --merge!  Wahoo!\n  t9903: --merge uses the interactive backend so the prompt expected is\n         now REBASE-i.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +--\n Makefile                          |   1 -\n builtin/rebase.c                  |  14 +--\n git-legacy-rebase.sh              |  43 ++++----\n git-rebase--merge.sh              | 166 ------------------------------\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t9903-bash-prompt.sh            |   2 +-\n 10 files changed, 42 insertions(+), 297 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 0d77ea5894..910b1d2d2f 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -124,7 +124,6 @@\n /git-rebase--am\n /git-rebase--common\n /git-rebase--interactive\n-/git-rebase--merge\n /git-rebase--preserve-merges\n /git-receive-pack\n /git-reflog\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 80793bad8d..8211f9357c 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n INCOMPATIBLE OPTIONS\n --------------------\n \n-git-rebase has many flags that are incompatible with each other,\n-predominantly due to the fact that it has three different underlying\n-implementations:\n-\n- * one based on linkgit:git-am[1] (the default)\n- * one based on git-merge-recursive (merge backend)\n- * one based on linkgit:git-cherry-pick[1] (interactive backend)\n-\n-Flags only understood by the am backend:\n+The following options:\n \n  * --committer-date-is-author-date\n  * --ignore-date\n@@ -520,15 +512,12 @@ Flags only understood by the am backend:\n  * --ignore-whitespace\n  * -C\n \n-Flags understood by both merge and interactive backends:\n+are incompatible with the following options:\n \n  * --merge\n  * --strategy\n  * --strategy-option\n  * --allow-empty-message\n-\n-Flags only understood by the interactive backend:\n-\n  * --[no-]autosquash\n  * --rebase-merges\n  * --preserve-merges\n@@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n  * --edit-todo\n  * --root when used in combination with --onto\n \n-Other incompatible flag pairs:\n+In addition, the following pairs of options are incompatible:\n \n  * --preserve-merges and --interactive\n  * --preserve-merges and --signoff\ndiff --git a/Makefile b/Makefile\nindex 1a44c811aa..82e1eb1a4a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -628,7 +628,6 @@ SCRIPT_LIB += git-parse-remote\n SCRIPT_LIB += git-rebase--am\n SCRIPT_LIB += git-rebase--common\n SCRIPT_LIB += git-rebase--preserve-merges\n-SCRIPT_LIB += git-rebase--merge\n SCRIPT_LIB += git-sh-setup\n SCRIPT_LIB += git-sh-i18n\n \ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex f1f449801b..39ed88040a 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -122,7 +122,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbreak;\n \tcase REBASE_MERGE:\n-\t\t/* we silently *upgrade* --merge to --interactive if needed */\n+\t\t/* we now implement --merge via --interactive */\n \tdefault:\n \t\topts->type = REBASE_INTERACTIVE; /* implied */\n \t\tbreak;\n@@ -481,10 +481,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n \t\tbackend = \"git-rebase--am\";\n \t\tbackend_func = \"git_rebase__am\";\n \t\tbreak;\n-\tcase REBASE_MERGE:\n-\t\tbackend = \"git-rebase--merge\";\n-\t\tbackend_func = \"git_rebase__merge\";\n-\t\tbreak;\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbackend = \"git-rebase--preserve-merges\";\n \t\tbackend_func = \"git_rebase__preserve_merges\";\n@@ -1170,6 +1166,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \t}\n \n+\tif (options.type == REBASE_MERGE)\n+\t\timply_interactive(&options, \"--merge\");\n+\n \tif (options.root && !options.onto_name)\n \t\timply_interactive(&options, \"--root without --onto\");\n \n@@ -1200,10 +1199,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \n \t\tif (is_interactive(&options) && i >= 0)\n \t\t\tdie(_(\"error: cannot combine am options \"\n-\t\t\t      \"with interactive options\"));\n-\t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine am options \"\n-\t\t\t      \"with merge options \"));\n+\t\t\t      \"with either interactive or merge options\"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 425189bde1..e41e0ed2ce 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -218,6 +218,7 @@ then\n \tstate_dir=\"$apply_dir\"\n elif test -d \"$merge_dir\"\n then\n+\ttype=interactive\n \tif test -d \"$merge_dir\"/rewritten\n \tthen\n \t\ttype=preserve-merges\n@@ -225,10 +226,7 @@ then\n \t\tpreserve_merges=t\n \telif test -f \"$merge_dir\"/interactive\n \tthen\n-\t\ttype=interactive\n \t\tinteractive_rebase=explicit\n-\telse\n-\t\ttype=merge\n \tfi\n \tstate_dir=\"$merge_dir\"\n fi\n@@ -477,6 +475,7 @@ then\n \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n fi\n \n+actually_interactive=\n if test -n \"$interactive_rebase\"\n then\n \tif test -z \"$preserve_merges\"\n@@ -485,11 +484,12 @@ then\n \telse\n \t\ttype=preserve-merges\n \tfi\n-\n+\tactually_interactive=t\n \tstate_dir=\"$merge_dir\"\n elif test -n \"$do_merge\"\n then\n-\ttype=merge\n+\tinteractive_rebase=implied\n+\ttype=interactive\n \tstate_dir=\"$merge_dir\"\n else\n \ttype=am\n@@ -505,13 +505,9 @@ incompatible_opts=$(echo \" $git_am_opt \" | \\\n \t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n if test -n \"$incompatible_opts\"\n then\n-\tif test -n \"$interactive_rebase\"\n-\tthen\n-\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n-\tfi\n-\tif test -n \"$do_merge\"\n+\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n \tthen\n-\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n+\t\tdie \"$(gettext \"error: cannot combine am options with either interactive or merge options\")\"\n \tfi\n fi\n \n@@ -676,7 +672,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n # but this should be done only when upstream and onto are the same\n # and if this is not an interactive rebase.\n mb=$(git merge-base \"$onto\" \"$orig_head\")\n-if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n+if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n \t# linear history?\n \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n@@ -720,6 +716,19 @@ then\n \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n fi\n \n+if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n+then\n+\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n+\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n+\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n+\t# If the $onto is a proper descendant of the tip of the branch, then\n+\t# we just fast-forwarded.\n+\tgit update-ref ORIG_HEAD $orig_head\n+\tmove_to_original_branch\n+\tfinish_rebase\n+\texit 0\n+fi\n+\n test -n \"$interactive_rebase\" && run_specific_rebase\n \n # Detach HEAD and reset the tree\n@@ -729,16 +738,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n \n-# If the $onto is a proper descendant of the tip of the branch, then\n-# we just fast-forwarded.\n-if test \"$mb\" = \"$orig_head\"\n-then\n-\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n-\tmove_to_original_branch\n-\tfinish_rebase\n-\texit 0\n-fi\n-\n if test -n \"$rebase_root\"\n then\n \trevisions=\"$onto..$orig_head\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\ndeleted file mode 100644\nindex ced38bb3a6..0000000000\n--- a/git-rebase--merge.sh\n+++ /dev/null\n@@ -1,166 +0,0 @@\n-# This shell script fragment is sourced by git-rebase to implement\n-# its merge-based non-interactive mode that copes well with renamed\n-# files.\n-#\n-# Copyright (c) 2010 Junio C Hamano.\n-#\n-\n-prec=4\n-\n-read_state () {\n-\tonto_name=$(cat \"$state_dir\"/onto_name) &&\n-\tend=$(cat \"$state_dir\"/end) &&\n-\tmsgnum=$(cat \"$state_dir\"/msgnum)\n-}\n-\n-continue_merge () {\n-\ttest -d \"$state_dir\" || die \"$state_dir directory does not exist\"\n-\n-\tunmerged=$(git ls-files -u)\n-\tif test -n \"$unmerged\"\n-\tthen\n-\t\techo \"You still have unmerged paths in your index\"\n-\t\techo \"did you forget to use git add?\"\n-\t\tdie \"$resolvemsg\"\n-\tfi\n-\n-\tcmt=$(cat \"$state_dir/current\")\n-\tif ! git diff-index --quiet --ignore-submodules HEAD --\n-\tthen\n-\t\tif ! git commit ${gpg_sign_opt:+\"$gpg_sign_opt\"} $signoff $allow_empty_message \\\n-\t\t\t--no-verify -C \"$cmt\"\n-\t\tthen\n-\t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n-\t\t\techo \"directly, but instead do one of the following: \"\n-\t\t\tdie \"$resolvemsg\"\n-\t\tfi\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Committed: %0${prec}d \" $msgnum\n-\t\tfi\n-\t\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\telse\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Already applied: %0${prec}d \" $msgnum\n-\t\tfi\n-\tfi\n-\ttest -z \"$GIT_QUIET\" &&\n-\tGIT_PAGER='' git log --format=%s -1 \"$cmt\"\n-\n-\t# onto the next patch:\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-}\n-\n-call_merge () {\n-\tmsgnum=\"$1\"\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt\" > \"$state_dir/current\"\n-\tgit update-ref REBASE_HEAD \"$cmt\"\n-\thd=$(git rev-parse --verify HEAD)\n-\tcmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)\n-\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n-\teval GITHEAD_$hd='$onto_name'\n-\texport GITHEAD_$cmt GITHEAD_$hd\n-\tif test -n \"$GIT_QUIET\"\n-\tthen\n-\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n-\tfi\n-\ttest -z \"$strategy\" && strategy=recursive\n-\t# If cmt doesn't have a parent, don't include it as a base\n-\tbase=$(git rev-parse --verify --quiet $cmt^)\n-\teval 'git merge-$strategy' $strategy_opts $base ' -- \"$hd\" \"$cmt\"'\n-\trv=$?\n-\tcase \"$rv\" in\n-\t0)\n-\t\tunset GITHEAD_$cmt GITHEAD_$hd\n-\t\treturn\n-\t\t;;\n-\t1)\n-\t\tgit rerere $allow_rerere_autoupdate\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t2)\n-\t\techo \"Strategy: $strategy failed, try another\" 1>&2\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t*)\n-\t\tdie \"Unknown exit code ($rv) from command:\" \\\n-\t\t\t\"git merge-$strategy $cmt^ -- HEAD $cmt\"\n-\t\t;;\n-\tesac\n-}\n-\n-finish_rb_merge () {\n-\tmove_to_original_branch\n-\tif test -s \"$state_dir\"/rewritten\n-\tthen\n-\t\tgit notes copy --for-rewrite=rebase <\"$state_dir\"/rewritten\n-\t\thook=\"$(git rev-parse --git-path hooks/post-rewrite)\"\n-\t\ttest -x \"$hook\" && \"$hook\" rebase <\"$state_dir\"/rewritten\n-\tfi\n-\tsay All done.\n-}\n-\n-git_rebase__merge () {\n-\n-case \"$action\" in\n-continue)\n-\tread_state\n-\tcontinue_merge\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-skip)\n-\tread_state\n-\tgit rerere clear\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\tmsgnum=$(($msgnum + 1))\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-show-current-patch)\n-\texec git show REBASE_HEAD --\n-\t;;\n-esac\n-\n-mkdir -p \"$state_dir\"\n-echo \"$onto_name\" > \"$state_dir/onto_name\"\n-write_basic_state\n-rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n-\n-msgnum=0\n-for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n-do\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n-done\n-\n-echo 1 >\"$state_dir/msgnum\"\n-echo $msgnum >\"$state_dir/end\"\n-\n-end=$msgnum\n-msgnum=1\n-\n-while test \"$msgnum\" -le \"$end\"\n-do\n-\tcall_merge \"$msgnum\"\n-\tcontinue_merge\n-done\n-\n-finish_rb_merge\n-\n-}\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex 38bd876cab..7320f015a7 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -17,14 +17,9 @@ test_expect_success 'setup' '\n \tgit tag start\n '\n \n-cat >expect <<\\EOF\n-Already applied: 0001 A\n-Already applied: 0002 B\n-Committed: 0003 Z\n-EOF\n-\n test_expect_success 'rebase -m' '\n \tgit rebase -m master >report &&\n+\t>expect &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex 4c7494cc8f..2d1094e483 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -53,41 +53,6 @@ create_expected_success_interactive () {\n \tEOF\n }\n \n-create_expected_success_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplied autostash.\n-\tEOF\n-}\n-\n create_expected_failure_am () {\n \tcat >expected <<-EOF\n \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n@@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n \tEOF\n }\n \n-create_expected_failure_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplying autostash resulted in conflicts.\n-\tYour changes are safe in the stash.\n-\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n-\tEOF\n-}\n-\n testrebase () {\n \ttype=$1\n \tdotest=$2\n@@ -177,6 +105,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type --autostash: check output\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_success_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\n@@ -274,6 +205,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_failure_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 23ad4cff35..7274dca40b 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -111,7 +111,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -126,7 +126,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -141,7 +141,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -284,7 +284,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -315,7 +315,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase failure -p\n \ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 81a5179e28..5cadedb2a9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n '\n \n test_expect_success 'prompt - rebase merge' '\n-\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n+\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n \tgit checkout b2 &&\n \ttest_when_finished \"git checkout master\" &&\n \ttest_must_fail git rebase --merge b1 b2 &&\n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363868","messageId":"20181122044841.20993-6-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 5/7] git-legacy-rebase: simplify unnecessary triply-nested if","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:39Z","receivedAt":"2018-11-22T04:48:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The git-legacy-rebase.sh script previously had code of the form:\n\nif git_am_opt:\n  if interactive:\n    if incompatible_opts:\n      show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    if incompatible_opts\n      show_error_about_merge_and_am_incompatibilities\n\nwhich was a triply nested if.  However, the first conditional\n(git_am_opt) and third (incompatible_opts) were somewhat redundant: the\nlatter condition was a strict subset of the former.  Simplify this by\nmoving the innermost conditional to the outside, allowing us to remove\nthe test on git_am_opt entirely and giving us the following form:\n\nif incomptable_opts:\n  if interactive:\n    show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    show_error_about_merge_and_am_incompatibilities\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-legacy-rebase.sh | 20 ++++++++------------\n 1 file changed, 8 insertions(+), 12 deletions(-)\n\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex d01eef9876..425189bde1 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -501,21 +501,17 @@ then\n \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n fi\n \n-if test -n \"$git_am_opt\"; then\n-\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n-\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+incompatible_opts=$(echo \" $git_am_opt \" | \\\n+\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+if test -n \"$incompatible_opts\"\n+then\n \tif test -n \"$interactive_rebase\"\n \tthen\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n-\t\tfi\n+\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n \tfi\n-\tif test -n \"$do_merge\"; then\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n-\t\tfi\n+\tif test -n \"$do_merge\"\n+\tthen\n+\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n \tfi\n fi\n \n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363869","messageId":"20181122044841.20993-4-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 3/7] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:37Z","receivedAt":"2018-11-22T04:49:00Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is supposed to be invoked for each rewritten\ncommit.  The fact that a commit was selected and processed by the rebase\noperation (even though when we hit an error a user said it had no more\nuseful changes), suggests we should write an entry for it.  In\nparticular, let's treat it as an empty commit trivially squashed into\nits parent.\n\nThis brings the rebase--am and rebase--merge backends in sync with the\nbehavior of the interactive rebase backend.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/am.c                 | 9 +++++++++\n git-rebase--merge.sh         | 2 ++\n t/t5407-post-rewrite-hook.sh | 3 +++\n 3 files changed, 14 insertions(+)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 8f27f3375b..af9d034838 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n \tif (clean_index(&head, &head))\n \t\tdie(_(\"failed to clean index\"));\n \n+\tif (state->rebasing) {\n+\t\tFILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n+\n+\t\tassert(!is_null_oid(&state->orig_commit));\n+\t\tfprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n+\t\tfprintf(fp, \"%s\\n\", oid_to_hex(&head));\n+\t\tfclose(fp);\n+\t}\n+\n \tam_next(state);\n \tam_load(state);\n \tam_run(state, 0);\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex aa2f2f0872..91250cbaed 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -121,6 +121,8 @@ continue)\n skip)\n \tread_state\n \tgit rerere clear\n+\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n+\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n \tmsgnum=$(($msgnum + 1))\n \twhile test \"$msgnum\" -le \"$end\"\n \tdo\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 6426ec8991..a4a5903cba 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -78,6 +78,7 @@ test_expect_success 'git rebase --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n@@ -91,6 +92,7 @@ test_expect_success 'git rebase --skip the last one' '\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n \t$(git rev-parse E) $(git rev-parse HEAD)\n+\t$(git rev-parse F) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n '\n@@ -120,6 +122,7 @@ test_expect_success 'git rebase -m --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"363870","messageId":"20181122044841.20993-7-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v3 6/7] rebase: define linearization ordering and enforce it","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-22T04:48:40Z","receivedAt":"2018-11-22T04:49:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Ever since commit 3f213981e44a (\"add tests for rebasing merged history\",\n2013-06-06), t3425 has had tests which included the rebasing of merged\nhistory and whose order of applied commits was checked.  Unfortunately,\nthe tests expected different behavior depending on which backend was in\nuse.  Implementing these checks was the following four lines (including\nthe TODO message) which were repeated verbatim three times in t3425:\n\n    #TODO: make order consistent across all flavors of rebase\n    test_run_rebase success 'e n o' ''\n    test_run_rebase success 'e n o' -m\n    test_run_rebase success 'n o e' -i\n\nAs part of the effort to reduce differences between the rebase backends\nso that users get more uniform behavior, let's define the correct\nbehavior and modify the different backends so they all get the right\nanswer.  It turns out that the difference in behavior here is entirely\ndue to topological sorting; since some backends require topological\nsorting (particularly when --rebase-merges is specified), require it for\nall modes.  Modify the am and merge backends to implement this.\n\nPerformance Considerations:\n\nI was unable to measure any appreciable performance difference with this\nchange.  Trying to control the run-to-run variation was difficult; I\neventually found a headless beefy box that I could ssh into, which\nseemed to help.  Using git.git, I ran the following testcase:\n    $ git reset --hard v2.20.0-rc1~2\n    $ time git rebase --quiet v2.20.0-rc0~16\n\nI first ran once to warm any disk caches, then ran five subsequent runs\nand recorded the times of those five.  I observed the following results\nfor the average time:\n\n     Before this change:\n       \"real\" timing: 1.340s (standard deviation: 0.040s)\n       \"user\" timing: 1.050s (standard deviation: 0.041s)\n       \"sys\"  timing: 0.270s (standard deviation: 0.011s)\n     After  this change:\n       \"real\" timing: 1.327s (standard deviation: 0.065s)\n       \"user\" timing: 1.031s (standard deviation: 0.061s)\n       \"sys\"  timing: 0.280s (standard deviation: 0.014s)\n\nMeasurements aside, I would expect the timing for walking revisions to\nbe dwarfed by the work involved in creating and applying patches, so\nthis isn't too surprising.  Further, while somewhat counter-intuitive,\nit is possible that turning on topological sorting is actually a\nperformance improvement: by way of comparison, turning on --topo-order\nmade fast-export faster (see\nhttps://public-inbox.org/git/20090211135640.GA19600@coredump.intra.peff.net/).\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-rebase--am.sh                 |  2 +-\n git-rebase--merge.sh              |  2 +-\n t/t3425-rebase-topology-merges.sh | 15 ++++++---------\n 3 files changed, 8 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 99b8c17787..6416716ee6 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -36,7 +36,7 @@ rm -f \"$GIT_DIR/rebased-patches\"\n \n git format-patch -k --stdout --full-index --cherry-pick --right-only \\\n \t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n-\t--pretty=mboxrd \\\n+\t--pretty=mboxrd --topo-order \\\n \t$git_format_patch_opt \\\n \t\"$revisions\" ${restrict_revision+^$restrict_revision} \\\n \t>\"$GIT_DIR/rebased-patches\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex 91250cbaed..ced38bb3a6 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -143,7 +143,7 @@ write_basic_state\n rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n \n msgnum=0\n-for cmt in $(git rev-list --reverse --no-merges \"$revisions\")\n+for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n do\n \tmsgnum=$(($msgnum + 1))\n \techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 5f892e33d7..fd8efe84fe 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -70,9 +70,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'e n o' ''\n-test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' ''\n+test_run_rebase success 'n o e' -m\n test_run_rebase success 'n o e' -i\n \n test_run_rebase () {\n@@ -87,9 +86,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_run_rebase () {\n@@ -104,9 +102,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n if ! test_have_prereq REBASE_P; then\n-- \n2.20.0.rc1.7.g58371d377a\n\n"},{"id":"364197","messageId":"nycvar.QRO.7.76.6.1811280000020.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181122044841.20993-2-newren@gmail.com","subject":"Re: [PATCH v3 1/7] rebase: fix incompatible options error message","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-11-28T08:28:47Z","receivedAt":"2018-11-28T08:28:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Wed, 21 Nov 2018, Elijah Newren wrote:\n\n> In commit f57696802c30 (\"rebase: really just passthru the `git am`\n> options\", 2018-11-14), the handling of `git am` options was simplified\n> dramatically (and an option parsing bug was fixed), but it introduced\n> a small regression in the error message shown when options only\n> understood by separate backends were used:\n> \n> $ git rebase --keep --ignore-whitespace\n> fatal: error: cannot combine interactive options (--interactive, --exec,\n> --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n> am options (.git/rebase-apply/applying)\n> \n> $ git rebase --merge --ignore-whitespace\n> fatal: error: cannot combine merge options (--merge, --strategy,\n> --strategy-option) with am options (.git/rebase-apply/applying)\n> \n> Note that in both cases, the list of \"am options\" is\n> \".git/rebase-apply/applying\", which makes no sense.  Since the lists of\n> backend-specific options is documented pretty thoroughly in the rebase\n> man page (in the \"Incompatible Options\" section, with multiple links\n> throughout the document), and since I expect this list to change over\n> time, just simplify the error message.\n> \n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n\nThis patch is obviously good.\n\nGiven that you embedded it in the patch series that makes the sequencer\nthe work horse also for the `merge` backend of `git rebase` in addition to\nthe `interactive` one, may I assume that you intend this patch for post\nv2.20.0?\n\nCiao,\nDscho\n\n>  builtin/rebase.c     | 11 ++++-------\n>  git-legacy-rebase.sh |  4 ++--\n>  2 files changed, 6 insertions(+), 9 deletions(-)\n> \n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 5b3e5baec8..5ece134ae6 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -1202,14 +1202,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n>  \t\t\t\tbreak;\n>  \n>  \t\tif (is_interactive(&options) && i >= 0)\n> -\t\t\tdie(_(\"error: cannot combine interactive options \"\n> -\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n> -\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n> -\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n> +\t\t\tdie(_(\"error: cannot combine am options \"\n> +\t\t\t      \"with interactive options\"));\n>  \t\tif (options.type == REBASE_MERGE && i >= 0)\n> -\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n> -\t\t\t      \"--strategy, --strategy-option) with am options \"\n> -\t\t\t      \"(%s)\"), buf.buf);\n> +\t\t\tdie(_(\"error: cannot combine am options \"\n> +\t\t\t      \"with merge options \"));\n>  \t}\n>  \n>  \tif (options.signoff) {\n> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n> index b97ffdc9dd..0a747eb76c 100755\n> --- a/git-legacy-rebase.sh\n> +++ b/git-legacy-rebase.sh\n> @@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n>  \tthen\n>  \t\tif test -n \"$incompatible_opts\"\n>  \t\tthen\n> -\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> +\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n>  \t\tfi\n>  \tfi\n>  \tif test -n \"$do_merge\"; then\n>  \t\tif test -n \"$incompatible_opts\"\n>  \t\tthen\n> -\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> +\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n>  \t\tfi\n>  \tfi\n>  fi\n> -- \n> 2.20.0.rc1.7.g58371d377a\n> \n> \n"},{"id":"364228","messageId":"CABPp-BFRrLUJDkyOz=UitGr0eKDxbVq1s19LpoOrY1FJKHsOUQ@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1811280000020.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v3 1/7] rebase: fix incompatible options error message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-28T15:58:19Z","receivedAt":"2018-11-28T15:58:34Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Nov 28, 2018 at 12:28 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Hi Elijah,\n>\n> On Wed, 21 Nov 2018, Elijah Newren wrote:\n>\n> > In commit f57696802c30 (\"rebase: really just passthru the `git am`\n> > options\", 2018-11-14), the handling of `git am` options was simplified\n> > dramatically (and an option parsing bug was fixed), but it introduced\n> > a small regression in the error message shown when options only\n> > understood by separate backends were used:\n> >\n> > $ git rebase --keep --ignore-whitespace\n> > fatal: error: cannot combine interactive options (--interactive, --exec,\n> > --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n> > am options (.git/rebase-apply/applying)\n> >\n> > $ git rebase --merge --ignore-whitespace\n> > fatal: error: cannot combine merge options (--merge, --strategy,\n> > --strategy-option) with am options (.git/rebase-apply/applying)\n> >\n> > Note that in both cases, the list of \"am options\" is\n> > \".git/rebase-apply/applying\", which makes no sense.  Since the lists of\n> > backend-specific options is documented pretty thoroughly in the rebase\n> > man page (in the \"Incompatible Options\" section, with multiple links\n> > throughout the document), and since I expect this list to change over\n> > time, just simplify the error message.\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n> > ---\n>\n> This patch is obviously good.\n>\n> Given that you embedded it in the patch series that makes the sequencer\n> the work horse also for the `merge` backend of `git rebase` in addition to\n> the `interactive` one, may I assume that you intend this patch for post\n> v2.20.0?\n>\n> Ciao,\n> Dscho\n\nI think post v2.20.0 probably makes the most sense.  I was unsure what\nthe policy was around changing strings late in the cycle, but figured\nthat the worst case with this regression is someone basically\nunderstands what the message is trying to say but thinks it might be\nsaying more than they understand and reach out with questions.  In\ncontrast, if we decide to change the string and some translators don't\nhave enough time to translate it before 2.20.0 goes out, then someone\nwho doesn't understand English gets an English error message, which\nseems a little worse.\n\nI at least wanted it to be discussed, though, which is why I\nhighlighted it in the cover letter.\n"},{"id":"364229","messageId":"CACsJy8BpVgTaE0EM9qkj5dK68x85ZbMmDZ-S7Jvf_KDqYrAW=A@mail.gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-2-newren@gmail.com","subject":"Re: [PATCH v3 1/7] rebase: fix incompatible options error message","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-11-28T16:12:06Z","receivedAt":"2018-11-28T16:12:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Nov 22, 2018 at 7:32 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> In commit f57696802c30 (\"rebase: really just passthru the `git am`\n> options\", 2018-11-14), the handling of `git am` options was simplified\n> dramatically (and an option parsing bug was fixed), but it introduced\n> a small regression in the error message shown when options only\n> understood by separate backends were used:\n>\n> $ git rebase --keep --ignore-whitespace\n> fatal: error: cannot combine interactive options (--interactive, --exec,\n> --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n> am options (.git/rebase-apply/applying)\n>\n> $ git rebase --merge --ignore-whitespace\n> fatal: error: cannot combine merge options (--merge, --strategy,\n> --strategy-option) with am options (.git/rebase-apply/applying)\n>\n> Note that in both cases, the list of \"am options\" is\n> \".git/rebase-apply/applying\", which makes no sense.  Since the lists of\n> backend-specific options is documented pretty thoroughly in the rebase\n> man page (in the \"Incompatible Options\" section, with multiple links\n> throughout the document), and since I expect this list to change over\n> time, just simplify the error message.\n\nCan we simplify it further and remove the \"error: \" prefix? \"fatal:\nerror: \" looks redundant.\n-- \nDuy\n"},{"id":"364230","messageId":"CABPp-BHAaap05w0e3d5k5tTHbbmba2OT=3k+=_hWvcZz5fh17A@mail.gmail.com","threadId":"49781","inReplyTo":"CACsJy8BpVgTaE0EM9qkj5dK68x85ZbMmDZ-S7Jvf_KDqYrAW=A@mail.gmail.com","subject":"Re: [PATCH v3 1/7] rebase: fix incompatible options error message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-11-28T16:31:45Z","receivedAt":"2018-11-28T16:32:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Nov 28, 2018 at 8:12 AM Duy Nguyen <pclouds@gmail.com> wrote:\n>\n> On Thu, Nov 22, 2018 at 7:32 PM Elijah Newren <newren@gmail.com> wrote:\n> >\n> > In commit f57696802c30 (\"rebase: really just passthru the `git am`\n> > options\", 2018-11-14), the handling of `git am` options was simplified\n> > dramatically (and an option parsing bug was fixed), but it introduced\n> > a small regression in the error message shown when options only\n> > understood by separate backends were used:\n> >\n> > $ git rebase --keep --ignore-whitespace\n> > fatal: error: cannot combine interactive options (--interactive, --exec,\n> > --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n> > am options (.git/rebase-apply/applying)\n> >\n> > $ git rebase --merge --ignore-whitespace\n> > fatal: error: cannot combine merge options (--merge, --strategy,\n> > --strategy-option) with am options (.git/rebase-apply/applying)\n> >\n> > Note that in both cases, the list of \"am options\" is\n> > \".git/rebase-apply/applying\", which makes no sense.  Since the lists of\n> > backend-specific options is documented pretty thoroughly in the rebase\n> > man page (in the \"Incompatible Options\" section, with multiple links\n> > throughout the document), and since I expect this list to change over\n> > time, just simplify the error message.\n>\n> Can we simplify it further and remove the \"error: \" prefix? \"fatal:\n> error: \" looks redundant.\n\nSure, I can do that.  Looks like there are a few other cases that need\nfixing as well:\n$ git grep error: builtin/rebase.c\nbuiltin/rebase.c:                       die(_(\"error: cannot combine\ninteractive options \"\nbuiltin/rebase.c:                       die(_(\"error: cannot combine\nmerge options (--merge, \"\nbuiltin/rebase.c:                       die(_(\"error: cannot combine\n'--preserve-merges' with \"\nbuiltin/rebase.c:                       die(_(\"error: cannot combine\n'--rebase-merges' with \"\nbuiltin/rebase.c:                       die(_(\"error: cannot combine\n'--rebase-merges' with \"\n\nPerhaps, for consistency, I should also change the error message in\nthe git-legacy-rebase.sh script to use 'fatal' instead of 'error'?:\n\n$ git grep error: *rebase*.sh\ngit-legacy-rebase.sh:                   die \"$(gettext \"error: cannot\ncombine interactive options (--interactive, --exec, --rebase-merges,\n--preserve-merges, --keep-empty, --root + --onto) with am options\n($incompatible_opts)\")\"\ngit-legacy-rebase.sh:                   die \"$(gettext \"error: cannot\ncombine merge options (--merge, --strategy, --strategy-option) with am\noptions ($incompatible_opts)\")\"\ngit-legacy-rebase.sh:           die \"$(gettext \"error: cannot combine\n'--signoff' with '--preserve-merges'\")\"\ngit-legacy-rebase.sh:           die \"$(gettext \"error: cannot combine\n'--preserve-merges' with '--rebase-merges'\")\"\ngit-legacy-rebase.sh:           die \"$(gettext \"error: cannot combine\n'--rebase-merges' with '--strategy-option'\")\"\ngit-legacy-rebase.sh:           die \"$(gettext \"error: cannot combine\n'--rebase-merges' with '--strategy'\")\"\n"},{"id":"365089","messageId":"20181211161139.31686-2-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 1/8] rebase: make builtin and legacy script error messages the same","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:32Z","receivedAt":"2018-12-11T16:11:54Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The conversion of the script version of rebase took messages that were\nprefixed with \"error:\" and passed them along to die(), which adds a\n\"fatal:\" prefix, thus resulting in messages of the form:\n\n  fatal: error: cannot combine...\n\nwhich seems redundant.  Remove the \"error:\" prefix from the builtin\nversion of rebase, and change the prefix from \"error:\" to \"fatal:\" in\nthe legacy script to match.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c     | 10 +++++-----\n git-legacy-rebase.sh | 12 ++++++------\n 2 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex b5c99ec10c..85f980bdce 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1223,12 +1223,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine interactive options \"\n+\t\t\tdie(_(\"cannot combine interactive options \"\n \t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n \t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n \t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n \t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n+\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n \t\t\t      \"--strategy, --strategy-option) with am options \"\n \t\t\t      \"(%s)\"), buf.buf);\n \t}\n@@ -1248,15 +1248,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t *       git-rebase.txt caveats with \"unless you know what you are doing\"\n \t\t */\n \t\tif (options.rebase_merges)\n-\t\t\tdie(_(\"error: cannot combine '--preserve-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--preserve-merges' with \"\n \t\t\t      \"'--rebase-merges'\"));\n \n \tif (options.rebase_merges) {\n \t\tif (strategy_options.nr)\n-\t\t\tdie(_(\"error: cannot combine '--rebase-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--rebase-merges' with \"\n \t\t\t      \"'--strategy-option'\"));\n \t\tif (options.strategy)\n-\t\t\tdie(_(\"error: cannot combine '--rebase-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--rebase-merges' with \"\n \t\t\t      \"'--strategy'\"));\n \t}\n \ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex b4c7dbfa57..11548e927c 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n \tthen\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n \t\tfi\n \tfi\n \tif test -n \"$do_merge\"; then\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n \t\tfi\n \tfi\n fi\n@@ -522,7 +522,7 @@ fi\n if test -n \"$signoff\"\n then\n \ttest -n \"$preserve_merges\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--signoff' with '--preserve-merges'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--signoff' with '--preserve-merges'\")\"\n \tgit_am_opt=\"$git_am_opt $signoff\"\n \tforce_rebase=t\n fi\n@@ -533,15 +533,15 @@ then\n \t# Note: incompatibility with --interactive is just a strong warning;\n \t#       git-rebase.txt caveats with \"unless you know what you are doing\"\n \ttest -n \"$rebase_merges\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--preserve-merges' with '--rebase-merges'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--preserve-merges' with '--rebase-merges'\")\"\n fi\n \n if test -n \"$rebase_merges\"\n then\n \ttest -n \"$strategy_opts\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--rebase-merges' with '--strategy-option'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--rebase-merges' with '--strategy-option'\")\"\n \ttest -n \"$strategy\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--rebase-merges' with '--strategy'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--rebase-merges' with '--strategy'\")\"\n fi\n \n if test -z \"$rebase_root\"\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365090","messageId":"20181211161139.31686-5-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 4/8] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:35Z","receivedAt":"2018-12-11T16:11:56Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is supposed to be invoked for each rewritten\ncommit.  The fact that a commit was selected and processed by the rebase\noperation (even though when we hit an error a user said it had no more\nuseful changes), suggests we should write an entry for it.  In\nparticular, let's treat it as an empty commit trivially squashed into\nits parent.\n\nThis brings the rebase--am and rebase--merge backends in sync with the\nbehavior of the interactive rebase backend.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/am.c                 | 9 +++++++++\n git-rebase--merge.sh         | 2 ++\n t/t5407-post-rewrite-hook.sh | 3 +++\n 3 files changed, 14 insertions(+)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 8f27f3375b..af9d034838 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n \tif (clean_index(&head, &head))\n \t\tdie(_(\"failed to clean index\"));\n \n+\tif (state->rebasing) {\n+\t\tFILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n+\n+\t\tassert(!is_null_oid(&state->orig_commit));\n+\t\tfprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n+\t\tfprintf(fp, \"%s\\n\", oid_to_hex(&head));\n+\t\tfclose(fp);\n+\t}\n+\n \tam_next(state);\n \tam_load(state);\n \tam_run(state, 0);\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex aa2f2f0872..91250cbaed 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -121,6 +121,8 @@ continue)\n skip)\n \tread_state\n \tgit rerere clear\n+\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n+\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n \tmsgnum=$(($msgnum + 1))\n \twhile test \"$msgnum\" -le \"$end\"\n \tdo\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 6426ec8991..a4a5903cba 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -78,6 +78,7 @@ test_expect_success 'git rebase --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n@@ -91,6 +92,7 @@ test_expect_success 'git rebase --skip the last one' '\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n \t$(git rev-parse E) $(git rev-parse HEAD)\n+\t$(git rev-parse F) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n '\n@@ -120,6 +122,7 @@ test_expect_success 'git rebase -m --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365091","messageId":"20181211161139.31686-1-newren@gmail.com","threadId":"49781","inReplyTo":"20181122044841.20993-1-newren@gmail.com","subject":"[PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:31Z","receivedAt":"2018-12-11T16:11:56Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"This series continues the work of making rebase more self-consistent\nby removing inconsistencies between different backends.  In\nparticular, this series focuses on making the merge machinery behave\nlike the interactive machinery (though a few differences between the am\nand interactive backends are also fixed along the way), and ultimately\nremoves the merge backend in favor of reimplementing the relevant\noptions on top of the interactive machinery.\n\nDifferences since v3 (full range-diff below):\n  - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n    out by Duy\n  - Rebased on 2.20.0\n\nElijah Newren (8):\n  rebase: make builtin and legacy script error messages the same\n  rebase: fix incompatible options error message\n  t5407: add a test demonstrating how interactive handles --skip\n    differently\n  am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n  git-rebase, sequencer: extend --quiet option for the interactive\n    machinery\n  git-legacy-rebase: simplify unnecessary triply-nested if\n  rebase: define linearization ordering and enforce it\n  rebase: Implement --merge via the interactive machinery\n\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +---\n Makefile                          |   1 -\n builtin/am.c                      |   9 ++\n builtin/rebase.c                  |  30 ++----\n git-legacy-rebase.sh              |  65 ++++++------\n git-rebase--am.sh                 |   2 +-\n git-rebase--common.sh             |   2 +-\n git-rebase--merge.sh              | 164 ------------------------------\n sequencer.c                       |  23 +++--\n sequencer.h                       |   1 +\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t3425-rebase-topology-merges.sh |  15 ++-\n t/t5407-post-rewrite-hook.sh      |  34 +++++++\n t/t9903-bash-prompt.sh            |   2 +-\n 17 files changed, 121 insertions(+), 340 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\nRange-diff:\n-:  ---------- > 1:  2e8b1bcb8b rebase: make builtin and legacy script error messages the same\n1:  2f4bdd1980 ! 2:  eba87828c6 rebase: fix incompatible options error message\n    @@ -9,12 +9,12 @@\n         understood by separate backends were used:\n     \n         $ git rebase --keep --ignore-whitespace\n    -    fatal: error: cannot combine interactive options (--interactive, --exec,\n    +    fatal: cannot combine interactive options (--interactive, --exec,\n         --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n         am options (.git/rebase-apply/applying)\n     \n         $ git rebase --merge --ignore-whitespace\n    -    fatal: error: cannot combine merge options (--merge, --strategy,\n    +    fatal: cannot combine merge options (--merge, --strategy,\n         --strategy-option) with am options (.git/rebase-apply/applying)\n     \n         Note that in both cases, the list of \"am options\" is\n    @@ -33,18 +33,17 @@\n      \t\t\t\tbreak;\n      \n      \t\tif (is_interactive(&options) && i >= 0)\n    --\t\t\tdie(_(\"error: cannot combine interactive options \"\n    +-\t\t\tdie(_(\"cannot combine interactive options \"\n     -\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n     -\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n     -\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n    -+\t\t\tdie(_(\"error: cannot combine am options \"\n    ++\t\t\tdie(_(\"cannot combine am options \"\n     +\t\t\t      \"with interactive options\"));\n      \t\tif (options.type == REBASE_MERGE && i >= 0)\n    --\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n    +-\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n     -\t\t\t      \"--strategy, --strategy-option) with am options \"\n     -\t\t\t      \"(%s)\"), buf.buf);\n    -+\t\t\tdie(_(\"error: cannot combine am options \"\n    -+\t\t\t      \"with merge options \"));\n    ++\t\t\tdie(_(\"cannot combine am options with merge options \"));\n      \t}\n      \n      \tif (options.signoff) {\n    @@ -56,15 +55,15 @@\n      \tthen\n      \t\tif test -n \"$incompatible_opts\"\n      \t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n    -+\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n    +-\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n    ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n      \t\tfi\n      \tfi\n      \tif test -n \"$do_merge\"; then\n      \t\tif test -n \"$incompatible_opts\"\n      \t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n    -+\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n    +-\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n    ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n      \t\tfi\n      \tfi\n      fi\n2:  cc33a8ccc1 = 3:  15d929edb2 t5407: add a test demonstrating how interactive handles --skip differently\n3:  f5838ef763 = 4:  c9d6d5141e am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n4:  50dc863d9f = 5:  0b19ad8e2d git-rebase, sequencer: extend --quiet option for the interactive machinery\n5:  35cf552f27 ! 6:  5ded8654ec git-legacy-rebase: simplify unnecessary triply-nested if\n    @@ -18,7 +18,7 @@\n         moving the innermost conditional to the outside, allowing us to remove\n         the test on git_am_opt entirely and giving us the following form:\n     \n    -    if incomptable_opts:\n    +    if incompatible_opts:\n           if interactive:\n             show_error_about_interactive_and_am_incompatibilities\n           if rebase-merge:\n    @@ -44,18 +44,18 @@\n      \tthen\n     -\t\tif test -n \"$incompatible_opts\"\n     -\t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n    +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n     -\t\tfi\n    -+\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n    ++\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n      \tfi\n     -\tif test -n \"$do_merge\"; then\n     -\t\tif test -n \"$incompatible_opts\"\n     -\t\tthen\n    --\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n    +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n     -\t\tfi\n     +\tif test -n \"$do_merge\"\n     +\tthen\n    -+\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n    ++\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n      \tfi\n      fi\n      \n6:  2a3d8ff1c1 = 7:  bb8e5a4527 rebase: define linearization ordering and enforce it\n7:  58371d377a ! 8:  5de428d695 rebase: Implement --merge via the interactive machinery\n    @@ -142,14 +142,15 @@\n      \t\timply_interactive(&options, \"--root without --onto\");\n      \n     @@\n    + \t\t\t\tbreak;\n      \n      \t\tif (is_interactive(&options) && i >= 0)\n    - \t\t\tdie(_(\"error: cannot combine am options \"\n    +-\t\t\tdie(_(\"cannot combine am options \"\n     -\t\t\t      \"with interactive options\"));\n     -\t\tif (options.type == REBASE_MERGE && i >= 0)\n    --\t\t\tdie(_(\"error: cannot combine am options \"\n    --\t\t\t      \"with merge options \"));\n    -+\t\t\t      \"with either interactive or merge options\"));\n    +-\t\t\tdie(_(\"cannot combine am options with merge options \"));\n    ++\t\t\tdie(_(\"cannot combine am options with either \"\n    ++\t\t\t      \"interactive or merge options\"));\n      \t}\n      \n      \tif (options.signoff) {\n    @@ -205,13 +206,13 @@\n      then\n     -\tif test -n \"$interactive_rebase\"\n     -\tthen\n    --\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n    +-\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n     -\tfi\n     -\tif test -n \"$do_merge\"\n     +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n      \tthen\n    --\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n    -+\t\tdie \"$(gettext \"error: cannot combine am options with either interactive or merge options\")\"\n    +-\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n    ++\t\tdie \"$(gettext \"fatal: cannot combine am options with either interactive or merge options\")\"\n      \tfi\n      fi\n      \n    @@ -225,7 +226,7 @@\n      \t# linear history?\n      \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n     @@\n    - \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n    + \tGIT_PAGER='' git diff --stat --summary \"$mb_tree\" \"$onto\"\n      fi\n      \n     +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365092","messageId":"20181211161139.31686-3-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 2/8] rebase: fix incompatible options error message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:33Z","receivedAt":"2018-12-11T16:11:58Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"In commit f57696802c30 (\"rebase: really just passthru the `git am`\noptions\", 2018-11-14), the handling of `git am` options was simplified\ndramatically (and an option parsing bug was fixed), but it introduced\na small regression in the error message shown when options only\nunderstood by separate backends were used:\n\n$ git rebase --keep --ignore-whitespace\nfatal: cannot combine interactive options (--interactive, --exec,\n--rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\nam options (.git/rebase-apply/applying)\n\n$ git rebase --merge --ignore-whitespace\nfatal: cannot combine merge options (--merge, --strategy,\n--strategy-option) with am options (.git/rebase-apply/applying)\n\nNote that in both cases, the list of \"am options\" is\n\".git/rebase-apply/applying\", which makes no sense.  Since the lists of\nbackend-specific options is documented pretty thoroughly in the rebase\nman page (in the \"Incompatible Options\" section, with multiple links\nthroughout the document), and since I expect this list to change over\ntime, just simplify the error message.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c     | 10 +++-------\n git-legacy-rebase.sh |  4 ++--\n 2 files changed, 5 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 85f980bdce..78e982298f 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1223,14 +1223,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"cannot combine interactive options \"\n-\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n-\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n-\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n+\t\t\tdie(_(\"cannot combine am options \"\n+\t\t\t      \"with interactive options\"));\n \t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n-\t\t\t      \"--strategy, --strategy-option) with am options \"\n-\t\t\t      \"(%s)\"), buf.buf);\n+\t\t\tdie(_(\"cannot combine am options with merge options \"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 11548e927c..fccb33b959 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n \tthen\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n \t\tfi\n \tfi\n \tif test -n \"$do_merge\"; then\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n \t\tfi\n \tfi\n fi\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365093","messageId":"20181211161139.31686-7-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 6/8] git-legacy-rebase: simplify unnecessary triply-nested if","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:37Z","receivedAt":"2018-12-11T16:11:58Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The git-legacy-rebase.sh script previously had code of the form:\n\nif git_am_opt:\n  if interactive:\n    if incompatible_opts:\n      show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    if incompatible_opts\n      show_error_about_merge_and_am_incompatibilities\n\nwhich was a triply nested if.  However, the first conditional\n(git_am_opt) and third (incompatible_opts) were somewhat redundant: the\nlatter condition was a strict subset of the former.  Simplify this by\nmoving the innermost conditional to the outside, allowing us to remove\nthe test on git_am_opt entirely and giving us the following form:\n\nif incompatible_opts:\n  if interactive:\n    show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    show_error_about_merge_and_am_incompatibilities\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-legacy-rebase.sh | 20 ++++++++------------\n 1 file changed, 8 insertions(+), 12 deletions(-)\n\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex f4088b7bda..6baf10192d 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -501,21 +501,17 @@ then\n \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n fi\n \n-if test -n \"$git_am_opt\"; then\n-\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n-\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+incompatible_opts=$(echo \" $git_am_opt \" | \\\n+\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+if test -n \"$incompatible_opts\"\n+then\n \tif test -n \"$interactive_rebase\"\n \tthen\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n-\t\tfi\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n \tfi\n-\tif test -n \"$do_merge\"; then\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n-\t\tfi\n+\tif test -n \"$do_merge\"\n+\tthen\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n \tfi\n fi\n \n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365094","messageId":"20181211161139.31686-9-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 8/8] rebase: Implement --merge via the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:39Z","receivedAt":"2018-12-11T16:11:59Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"As part of an ongoing effort to make rebase have more uniform behavior,\nmodify the merge backend to behave like the interactive one, by\nre-implementing it on top of the latter.\n\nInteractive rebases are implemented in terms of cherry-pick rather than\nthe merge-recursive builtin, but cherry-pick also calls into the\nrecursive merge machinery by default and can accept special merge\nstrategies and/or special strategy options.  As such, there really is\nnot any need for having both git-rebase--merge and\ngit-rebase--interactive anymore.  Delete git-rebase--merge.sh and\ninstead implement it in builtin/rebase.c.\n\nThis results in a few deliberate but small user-visible changes:\n  * The progress output is modified (see t3406 and t3420 for examples)\n  * A few known test failures are now fixed (see t3421)\n  * bash-prompt during a rebase --merge is now REBASE-i instead of\n    REBASE-m.  Reason: The prompt is a reflection of the backend in use;\n    this allows users to report an issue to the git mailing list with\n    the appropriate backend information, and allows advanced users to\n    know where to search for relevant control files.  (see t9903)\n\ntestcase modification notes:\n  t3406: --interactive and --merge had slightly different progress output\n         while running; adjust a test to match the new expectation\n  t3420: these test precise output while running, but rebase--am,\n         rebase--merge, and rebase--interactive all were built on very\n         different commands (am, merge-recursive, cherry-pick), so the\n         tests expected different output for each type.  Now we expect\n         --merge and --interactive to have the same output.\n  t3421: --interactive fixes some bugs in --merge!  Wahoo!\n  t9903: --merge uses the interactive backend so the prompt expected is\n         now REBASE-i.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +--\n Makefile                          |   1 -\n builtin/rebase.c                  |  15 ++-\n git-legacy-rebase.sh              |  43 ++++----\n git-rebase--merge.sh              | 166 ------------------------------\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t9903-bash-prompt.sh            |   2 +-\n 10 files changed, 43 insertions(+), 297 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 0d77ea5894..910b1d2d2f 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -124,7 +124,6 @@\n /git-rebase--am\n /git-rebase--common\n /git-rebase--interactive\n-/git-rebase--merge\n /git-rebase--preserve-merges\n /git-receive-pack\n /git-reflog\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex dff17b3178..8bfa36a185 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n INCOMPATIBLE OPTIONS\n --------------------\n \n-git-rebase has many flags that are incompatible with each other,\n-predominantly due to the fact that it has three different underlying\n-implementations:\n-\n- * one based on linkgit:git-am[1] (the default)\n- * one based on git-merge-recursive (merge backend)\n- * one based on linkgit:git-cherry-pick[1] (interactive backend)\n-\n-Flags only understood by the am backend:\n+The following options:\n \n  * --committer-date-is-author-date\n  * --ignore-date\n@@ -520,15 +512,12 @@ Flags only understood by the am backend:\n  * --ignore-whitespace\n  * -C\n \n-Flags understood by both merge and interactive backends:\n+are incompatible with the following options:\n \n  * --merge\n  * --strategy\n  * --strategy-option\n  * --allow-empty-message\n-\n-Flags only understood by the interactive backend:\n-\n  * --[no-]autosquash\n  * --rebase-merges\n  * --preserve-merges\n@@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n  * --edit-todo\n  * --root when used in combination with --onto\n \n-Other incompatible flag pairs:\n+In addition, the following pairs of options are incompatible:\n \n  * --preserve-merges and --interactive\n  * --preserve-merges and --signoff\ndiff --git a/Makefile b/Makefile\nindex 1a44c811aa..82e1eb1a4a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -628,7 +628,6 @@ SCRIPT_LIB += git-parse-remote\n SCRIPT_LIB += git-rebase--am\n SCRIPT_LIB += git-rebase--common\n SCRIPT_LIB += git-rebase--preserve-merges\n-SCRIPT_LIB += git-rebase--merge\n SCRIPT_LIB += git-sh-setup\n SCRIPT_LIB += git-sh-i18n\n \ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex ec2e5fbf23..d95843a8d4 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -122,7 +122,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbreak;\n \tcase REBASE_MERGE:\n-\t\t/* we silently *upgrade* --merge to --interactive if needed */\n+\t\t/* we now implement --merge via --interactive */\n \tdefault:\n \t\topts->type = REBASE_INTERACTIVE; /* implied */\n \t\tbreak;\n@@ -481,10 +481,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n \t\tbackend = \"git-rebase--am\";\n \t\tbackend_func = \"git_rebase__am\";\n \t\tbreak;\n-\tcase REBASE_MERGE:\n-\t\tbackend = \"git-rebase--merge\";\n-\t\tbackend_func = \"git_rebase__merge\";\n-\t\tbreak;\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbackend = \"git-rebase--preserve-merges\";\n \t\tbackend_func = \"git_rebase__preserve_merges\";\n@@ -1191,6 +1187,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \t}\n \n+\tif (options.type == REBASE_MERGE)\n+\t\timply_interactive(&options, \"--merge\");\n+\n \tif (options.root && !options.onto_name)\n \t\timply_interactive(&options, \"--root without --onto\");\n \n@@ -1220,10 +1219,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"cannot combine am options \"\n-\t\t\t      \"with interactive options\"));\n-\t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"cannot combine am options with merge options \"));\n+\t\t\tdie(_(\"cannot combine am options with either \"\n+\t\t\t      \"interactive or merge options\"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 6baf10192d..0c9c19bc60 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -218,6 +218,7 @@ then\n \tstate_dir=\"$apply_dir\"\n elif test -d \"$merge_dir\"\n then\n+\ttype=interactive\n \tif test -d \"$merge_dir\"/rewritten\n \tthen\n \t\ttype=preserve-merges\n@@ -225,10 +226,7 @@ then\n \t\tpreserve_merges=t\n \telif test -f \"$merge_dir\"/interactive\n \tthen\n-\t\ttype=interactive\n \t\tinteractive_rebase=explicit\n-\telse\n-\t\ttype=merge\n \tfi\n \tstate_dir=\"$merge_dir\"\n fi\n@@ -477,6 +475,7 @@ then\n \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n fi\n \n+actually_interactive=\n if test -n \"$interactive_rebase\"\n then\n \tif test -z \"$preserve_merges\"\n@@ -485,11 +484,12 @@ then\n \telse\n \t\ttype=preserve-merges\n \tfi\n-\n+\tactually_interactive=t\n \tstate_dir=\"$merge_dir\"\n elif test -n \"$do_merge\"\n then\n-\ttype=merge\n+\tinteractive_rebase=implied\n+\ttype=interactive\n \tstate_dir=\"$merge_dir\"\n else\n \ttype=am\n@@ -505,13 +505,9 @@ incompatible_opts=$(echo \" $git_am_opt \" | \\\n \t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n if test -n \"$incompatible_opts\"\n then\n-\tif test -n \"$interactive_rebase\"\n-\tthen\n-\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n-\tfi\n-\tif test -n \"$do_merge\"\n+\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n \tthen\n-\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with either interactive or merge options\")\"\n \tfi\n fi\n \n@@ -676,7 +672,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n # but this should be done only when upstream and onto are the same\n # and if this is not an interactive rebase.\n mb=$(git merge-base \"$onto\" \"$orig_head\")\n-if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n+if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n \t# linear history?\n \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n@@ -726,6 +722,19 @@ then\n \tGIT_PAGER='' git diff --stat --summary \"$mb_tree\" \"$onto\"\n fi\n \n+if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n+then\n+\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n+\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n+\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n+\t# If the $onto is a proper descendant of the tip of the branch, then\n+\t# we just fast-forwarded.\n+\tgit update-ref ORIG_HEAD $orig_head\n+\tmove_to_original_branch\n+\tfinish_rebase\n+\texit 0\n+fi\n+\n test -n \"$interactive_rebase\" && run_specific_rebase\n \n # Detach HEAD and reset the tree\n@@ -735,16 +744,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n \n-# If the $onto is a proper descendant of the tip of the branch, then\n-# we just fast-forwarded.\n-if test \"$mb\" = \"$orig_head\"\n-then\n-\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n-\tmove_to_original_branch\n-\tfinish_rebase\n-\texit 0\n-fi\n-\n if test -n \"$rebase_root\"\n then\n \trevisions=\"$onto..$orig_head\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\ndeleted file mode 100644\nindex ced38bb3a6..0000000000\n--- a/git-rebase--merge.sh\n+++ /dev/null\n@@ -1,166 +0,0 @@\n-# This shell script fragment is sourced by git-rebase to implement\n-# its merge-based non-interactive mode that copes well with renamed\n-# files.\n-#\n-# Copyright (c) 2010 Junio C Hamano.\n-#\n-\n-prec=4\n-\n-read_state () {\n-\tonto_name=$(cat \"$state_dir\"/onto_name) &&\n-\tend=$(cat \"$state_dir\"/end) &&\n-\tmsgnum=$(cat \"$state_dir\"/msgnum)\n-}\n-\n-continue_merge () {\n-\ttest -d \"$state_dir\" || die \"$state_dir directory does not exist\"\n-\n-\tunmerged=$(git ls-files -u)\n-\tif test -n \"$unmerged\"\n-\tthen\n-\t\techo \"You still have unmerged paths in your index\"\n-\t\techo \"did you forget to use git add?\"\n-\t\tdie \"$resolvemsg\"\n-\tfi\n-\n-\tcmt=$(cat \"$state_dir/current\")\n-\tif ! git diff-index --quiet --ignore-submodules HEAD --\n-\tthen\n-\t\tif ! git commit ${gpg_sign_opt:+\"$gpg_sign_opt\"} $signoff $allow_empty_message \\\n-\t\t\t--no-verify -C \"$cmt\"\n-\t\tthen\n-\t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n-\t\t\techo \"directly, but instead do one of the following: \"\n-\t\t\tdie \"$resolvemsg\"\n-\t\tfi\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Committed: %0${prec}d \" $msgnum\n-\t\tfi\n-\t\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\telse\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Already applied: %0${prec}d \" $msgnum\n-\t\tfi\n-\tfi\n-\ttest -z \"$GIT_QUIET\" &&\n-\tGIT_PAGER='' git log --format=%s -1 \"$cmt\"\n-\n-\t# onto the next patch:\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-}\n-\n-call_merge () {\n-\tmsgnum=\"$1\"\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt\" > \"$state_dir/current\"\n-\tgit update-ref REBASE_HEAD \"$cmt\"\n-\thd=$(git rev-parse --verify HEAD)\n-\tcmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)\n-\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n-\teval GITHEAD_$hd='$onto_name'\n-\texport GITHEAD_$cmt GITHEAD_$hd\n-\tif test -n \"$GIT_QUIET\"\n-\tthen\n-\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n-\tfi\n-\ttest -z \"$strategy\" && strategy=recursive\n-\t# If cmt doesn't have a parent, don't include it as a base\n-\tbase=$(git rev-parse --verify --quiet $cmt^)\n-\teval 'git merge-$strategy' $strategy_opts $base ' -- \"$hd\" \"$cmt\"'\n-\trv=$?\n-\tcase \"$rv\" in\n-\t0)\n-\t\tunset GITHEAD_$cmt GITHEAD_$hd\n-\t\treturn\n-\t\t;;\n-\t1)\n-\t\tgit rerere $allow_rerere_autoupdate\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t2)\n-\t\techo \"Strategy: $strategy failed, try another\" 1>&2\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t*)\n-\t\tdie \"Unknown exit code ($rv) from command:\" \\\n-\t\t\t\"git merge-$strategy $cmt^ -- HEAD $cmt\"\n-\t\t;;\n-\tesac\n-}\n-\n-finish_rb_merge () {\n-\tmove_to_original_branch\n-\tif test -s \"$state_dir\"/rewritten\n-\tthen\n-\t\tgit notes copy --for-rewrite=rebase <\"$state_dir\"/rewritten\n-\t\thook=\"$(git rev-parse --git-path hooks/post-rewrite)\"\n-\t\ttest -x \"$hook\" && \"$hook\" rebase <\"$state_dir\"/rewritten\n-\tfi\n-\tsay All done.\n-}\n-\n-git_rebase__merge () {\n-\n-case \"$action\" in\n-continue)\n-\tread_state\n-\tcontinue_merge\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-skip)\n-\tread_state\n-\tgit rerere clear\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\tmsgnum=$(($msgnum + 1))\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-show-current-patch)\n-\texec git show REBASE_HEAD --\n-\t;;\n-esac\n-\n-mkdir -p \"$state_dir\"\n-echo \"$onto_name\" > \"$state_dir/onto_name\"\n-write_basic_state\n-rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n-\n-msgnum=0\n-for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n-do\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n-done\n-\n-echo 1 >\"$state_dir/msgnum\"\n-echo $msgnum >\"$state_dir/end\"\n-\n-end=$msgnum\n-msgnum=1\n-\n-while test \"$msgnum\" -le \"$end\"\n-do\n-\tcall_merge \"$msgnum\"\n-\tcontinue_merge\n-done\n-\n-finish_rb_merge\n-\n-}\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex f64b130cb8..b393e1e9fe 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -17,14 +17,9 @@ test_expect_success 'setup' '\n \tgit tag start\n '\n \n-cat >expect <<\\EOF\n-Already applied: 0001 A\n-Already applied: 0002 B\n-Committed: 0003 Z\n-EOF\n-\n test_expect_success 'rebase -m' '\n \tgit rebase -m master >report &&\n+\t>expect &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex 4c7494cc8f..2d1094e483 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -53,41 +53,6 @@ create_expected_success_interactive () {\n \tEOF\n }\n \n-create_expected_success_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplied autostash.\n-\tEOF\n-}\n-\n create_expected_failure_am () {\n \tcat >expected <<-EOF\n \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n@@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n \tEOF\n }\n \n-create_expected_failure_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplying autostash resulted in conflicts.\n-\tYour changes are safe in the stash.\n-\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n-\tEOF\n-}\n-\n testrebase () {\n \ttype=$1\n \tdotest=$2\n@@ -177,6 +105,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type --autostash: check output\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_success_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\n@@ -274,6 +205,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_failure_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 23ad4cff35..7274dca40b 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -111,7 +111,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -126,7 +126,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -141,7 +141,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -284,7 +284,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -315,7 +315,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase failure -p\n \ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 81a5179e28..5cadedb2a9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n '\n \n test_expect_success 'prompt - rebase merge' '\n-\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n+\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n \tgit checkout b2 &&\n \ttest_when_finished \"git checkout master\" &&\n \ttest_must_fail git rebase --merge b1 b2 &&\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365095","messageId":"20181211161139.31686-6-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:36Z","receivedAt":"2018-12-11T16:12:01Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"While 'quiet' and 'interactive' may sound like antonyms, the interactive\nmachinery actually has logic that implements several\ninteractive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\nwhich won't pop up an editor.  The rewrite of interactive rebase in C\nadded a quiet option, though it only turns stats off.  Since we want to\nmake the interactive machinery also take over for git-rebase--merge, it\nshould fully implement the --quiet option.\n\ngit-rebase--interactive was already somewhat quieter than\ngit-rebase--merge and git-rebase--am, possibly because cherry-pick has\njust traditionally been quieter.  As such, we only drop a few\ninformational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n\nAlso, for simplicity, remove the differences in how quiet and verbose\noptions were recorded.  Having one be signalled by the presence of a\n\"verbose\" file in the state_dir, while the other was signalled by the\ncontents of a \"quiet\" file was just weirdly inconsistent.  (This\ninconsistency pre-dated the rewrite into C.)  Make them consistent by\nhaving them both key off the presence of the file.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c      |  5 +----\n git-legacy-rebase.sh  |  2 +-\n git-rebase--common.sh |  2 +-\n sequencer.c           | 23 +++++++++++++----------\n sequencer.h           |  1 +\n 5 files changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 78e982298f..ec2e5fbf23 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n \tif (get_oid(buf.buf, &opts->orig_head))\n \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n \n-\tstrbuf_reset(&buf);\n-\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n-\t\treturn -1;\n-\tif (buf.len)\n+\tif (file_exists(state_dir_path(\"quiet\", opts)))\n \t\topts->flags &= ~REBASE_NO_QUIET;\n \telse\n \t\topts->flags |= REBASE_NO_QUIET;\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex fccb33b959..f4088b7bda 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -113,7 +113,7 @@ read_basic_state () {\n \telse\n \t\torig_head=$(cat \"$state_dir\"/head)\n \tfi &&\n-\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n+\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n \ttest -f \"$state_dir\"/verbose && verbose=t\n \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n \ttest -f \"$state_dir\"/strategy_opts &&\ndiff --git a/git-rebase--common.sh b/git-rebase--common.sh\nindex 7e39d22871..dc18c682fa 100644\n--- a/git-rebase--common.sh\n+++ b/git-rebase--common.sh\n@@ -10,7 +10,7 @@ write_basic_state () {\n \techo \"$head_name\" > \"$state_dir\"/head-name &&\n \techo \"$onto\" > \"$state_dir\"/onto &&\n \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n-\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n+\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\ndiff --git a/sequencer.c b/sequencer.c\nindex e1a4dd15f1..bc25615050 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n+static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n@@ -157,7 +158,6 @@ 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-static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n \n static int git_sequencer_config(const char *k, const char *v, void *cb)\n {\n@@ -2357,6 +2357,9 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\tif (file_exists(rebase_path_verbose()))\n \t\t\topts->verbose = 1;\n \n+\t\tif (file_exists(rebase_path_quiet()))\n+\t\t\topts->quiet = 1;\n+\n \t\tif (file_exists(rebase_path_signoff())) {\n \t\t\topts->allow_ff = 0;\n \t\t\topts->signoff = 1;\n@@ -2424,9 +2427,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n \n \tif (quiet)\n \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n-\telse\n-\t\twrite_file(rebase_path_quiet(), \"\\n\");\n-\n \tif (opts->verbose)\n \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n \tif (opts->strategy)\n@@ -3503,10 +3503,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n \t\t\t\t\tfclose(f);\n \t\t\t\t}\n-\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n-\t\t\t\t\ttodo_list->done_nr,\n-\t\t\t\t\ttodo_list->total_nr,\n-\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n+\t\t\t\tif (!opts->quiet)\n+\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n+\t\t\t\t\t\ttodo_list->done_nr,\n+\t\t\t\t\t\ttodo_list->total_nr,\n+\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n \t\t\t}\n \t\t\tunlink(rebase_path_message());\n \t\t\tunlink(rebase_path_author_script());\n@@ -3738,8 +3739,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t}\n \t\tapply_autostash(opts);\n \n-\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n-\t\t\thead_ref.buf);\n+\t\tif (!opts->quiet)\n+\t\t\tfprintf(stderr,\n+\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n+\t\t\t\thead_ref.buf);\n \n \t\tstrbuf_release(&buf);\n \t\tstrbuf_release(&head_ref);\ndiff --git a/sequencer.h b/sequencer.h\nindex 5071a73563..729222b583 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -39,6 +39,7 @@ struct replay_opts {\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n \tint verbose;\n+\tint quiet;\n \n \tint mainline;\n \n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365096","messageId":"20181211161139.31686-8-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 7/8] rebase: define linearization ordering and enforce it","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:38Z","receivedAt":"2018-12-11T16:12:03Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Ever since commit 3f213981e44a (\"add tests for rebasing merged history\",\n2013-06-06), t3425 has had tests which included the rebasing of merged\nhistory and whose order of applied commits was checked.  Unfortunately,\nthe tests expected different behavior depending on which backend was in\nuse.  Implementing these checks was the following four lines (including\nthe TODO message) which were repeated verbatim three times in t3425:\n\n    #TODO: make order consistent across all flavors of rebase\n    test_run_rebase success 'e n o' ''\n    test_run_rebase success 'e n o' -m\n    test_run_rebase success 'n o e' -i\n\nAs part of the effort to reduce differences between the rebase backends\nso that users get more uniform behavior, let's define the correct\nbehavior and modify the different backends so they all get the right\nanswer.  It turns out that the difference in behavior here is entirely\ndue to topological sorting; since some backends require topological\nsorting (particularly when --rebase-merges is specified), require it for\nall modes.  Modify the am and merge backends to implement this.\n\nPerformance Considerations:\n\nI was unable to measure any appreciable performance difference with this\nchange.  Trying to control the run-to-run variation was difficult; I\neventually found a headless beefy box that I could ssh into, which\nseemed to help.  Using git.git, I ran the following testcase:\n    $ git reset --hard v2.20.0-rc1~2\n    $ time git rebase --quiet v2.20.0-rc0~16\n\nI first ran once to warm any disk caches, then ran five subsequent runs\nand recorded the times of those five.  I observed the following results\nfor the average time:\n\n     Before this change:\n       \"real\" timing: 1.340s (standard deviation: 0.040s)\n       \"user\" timing: 1.050s (standard deviation: 0.041s)\n       \"sys\"  timing: 0.270s (standard deviation: 0.011s)\n     After  this change:\n       \"real\" timing: 1.327s (standard deviation: 0.065s)\n       \"user\" timing: 1.031s (standard deviation: 0.061s)\n       \"sys\"  timing: 0.280s (standard deviation: 0.014s)\n\nMeasurements aside, I would expect the timing for walking revisions to\nbe dwarfed by the work involved in creating and applying patches, so\nthis isn't too surprising.  Further, while somewhat counter-intuitive,\nit is possible that turning on topological sorting is actually a\nperformance improvement: by way of comparison, turning on --topo-order\nmade fast-export faster (see\nhttps://public-inbox.org/git/20090211135640.GA19600@coredump.intra.peff.net/).\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-rebase--am.sh                 |  2 +-\n git-rebase--merge.sh              |  2 +-\n t/t3425-rebase-topology-merges.sh | 15 ++++++---------\n 3 files changed, 8 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 99b8c17787..6416716ee6 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -36,7 +36,7 @@ rm -f \"$GIT_DIR/rebased-patches\"\n \n git format-patch -k --stdout --full-index --cherry-pick --right-only \\\n \t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n-\t--pretty=mboxrd \\\n+\t--pretty=mboxrd --topo-order \\\n \t$git_format_patch_opt \\\n \t\"$revisions\" ${restrict_revision+^$restrict_revision} \\\n \t>\"$GIT_DIR/rebased-patches\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex 91250cbaed..ced38bb3a6 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -143,7 +143,7 @@ write_basic_state\n rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n \n msgnum=0\n-for cmt in $(git rev-list --reverse --no-merges \"$revisions\")\n+for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n do\n \tmsgnum=$(($msgnum + 1))\n \techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 5f892e33d7..fd8efe84fe 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -70,9 +70,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'e n o' ''\n-test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' ''\n+test_run_rebase success 'n o e' -m\n test_run_rebase success 'n o e' -i\n \n test_run_rebase () {\n@@ -87,9 +86,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_run_rebase () {\n@@ -104,9 +102,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n if ! test_have_prereq REBASE_P; then\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"365097","messageId":"20181211161139.31686-4-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v4 3/8] t5407: add a test demonstrating how interactive handles --skip differently","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-12-11T16:11:34Z","receivedAt":"2018-12-11T16:12:05Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is documented as being invoked by commands that\nrewrite commits such as commit --amend and rebase, and that it will\nbe called for each rewritten commit.\n\nApparently, the three backends handled --skip'ed commits differently:\n  am: treat the skipped commit as though it weren't rewritten\n  merge: same as 'am' backend\n  interactive: treat skipped commits as having been rewritten to empty\n     (view them as an empty fixup to their parent)\n\nFor now, just add a testcase documenting the different behavior (use\n--keep to force usage of the interactive machinery even though we have\nno empty commits).  A subsequent commit will remove the inconsistency in\n--skip handling.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n t/t5407-post-rewrite-hook.sh | 31 +++++++++++++++++++++++++++++++\n 1 file changed, 31 insertions(+)\n\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 9b2a274c71..6426ec8991 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '\n \tverify_hook_input\n '\n \n+test_expect_success 'git rebase with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\techo C > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n+test_expect_success 'git rebase --skip with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\ttest_must_fail git rebase --skip &&\n+\techo D > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n set_fake_editor\n-- \n2.20.0.8.g5de428d695\n\n"},{"id":"366266","messageId":"CABPp-BE83Oe15U4yrkcV_-qzWocMS4UcVeG1VEoac-jXgw9Peg@mail.gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-07T17:15:42Z","receivedAt":"2019-01-07T17:15:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n>\n> This series continues the work of making rebase more self-consistent\n> by removing inconsistencies between different backends.  In\n> particular, this series focuses on making the merge machinery behave\n> like the interactive machinery (though a few differences between the am\n> and interactive backends are also fixed along the way), and ultimately\n> removes the merge backend in favor of reimplementing the relevant\n> options on top of the interactive machinery.\n\nFriendly ping...let me know if you want me to simply resend v4.\n\n> Differences since v3 (full range-diff below):\n>   - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n>     out by Duy\n>   - Rebased on 2.20.0\n>\n> Elijah Newren (8):\n>   rebase: make builtin and legacy script error messages the same\n>   rebase: fix incompatible options error message\n>   t5407: add a test demonstrating how interactive handles --skip\n>     differently\n>   am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n>   git-rebase, sequencer: extend --quiet option for the interactive\n>     machinery\n>   git-legacy-rebase: simplify unnecessary triply-nested if\n>   rebase: define linearization ordering and enforce it\n>   rebase: Implement --merge via the interactive machinery\n>\n...\n"},{"id":"366283","messageId":"xmqq4lak8d4g.fsf@gitster-ct.c.googlers.com","threadId":"49781","inReplyTo":"CABPp-BE83Oe15U4yrkcV_-qzWocMS4UcVeG1VEoac-jXgw9Peg@mail.gmail.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-07T19:46:23Z","receivedAt":"2019-01-07T19:46:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n>>\n>> This series continues the work of making rebase more self-consistent\n>> by removing inconsistencies between different backends.  In\n>> particular, this series focuses on making the merge machinery behave\n>> like the interactive machinery (though a few differences between the am\n>> and interactive backends are also fixed along the way), and ultimately\n>> removes the merge backend in favor of reimplementing the relevant\n>> options on top of the interactive machinery.\n>\n> Friendly ping...let me know if you want me to simply resend v4.\n>\n\nIf you have anything newer than 90673135 (\"rebase: Implement --merge\nvia the interactive machinery\", 2018-12-11), then yeah, I haven't\nseen it.\n\nThanks.\n\nP.S. even if that one is latest, I would need to downcase Implement\nbefore it hits 'next' ;-)\n\n>> Differences since v3 (full range-diff below):\n>>   - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n>>     out by Duy\n>>   - Rebased on 2.20.0\n>>\n>> Elijah Newren (8):\n>>   rebase: make builtin and legacy script error messages the same\n>>   rebase: fix incompatible options error message\n>>   t5407: add a test demonstrating how interactive handles --skip\n>>     differently\n>>   am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n>>   git-rebase, sequencer: extend --quiet option for the interactive\n>>     machinery\n>>   git-legacy-rebase: simplify unnecessary triply-nested if\n>>   rebase: define linearization ordering and enforce it\n>>   rebase: Implement --merge via the interactive machinery\n>>\n> ...\n"},{"id":"366284","messageId":"xmqqzhsc6xdk.fsf@gitster-ct.c.googlers.com","threadId":"49781","inReplyTo":"xmqq4lak8d4g.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-07T20:11:51Z","receivedAt":"2019-01-07T20:11:58Z","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> Elijah Newren <newren@gmail.com> writes:\n>\n>> On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n>>>\n>>> This series continues the work of making rebase more self-consistent\n>>> by removing inconsistencies between different backends.  In\n>>> particular, this series focuses on making the merge machinery behave\n>>> like the interactive machinery (though a few differences between the am\n>>> and interactive backends are also fixed along the way), and ultimately\n>>> removes the merge backend in favor of reimplementing the relevant\n>>> options on top of the interactive machinery.\n>>\n>> Friendly ping...let me know if you want me to simply resend v4.\n>>\n>\n> If you have anything newer than 90673135 (\"rebase: Implement --merge\n> via the interactive machinery\", 2018-12-11), then yeah, I haven't\n> seen it.\n>\n> Thanks.\n>\n> P.S. even if that one is latest, I would need to downcase Implement\n> before it hits 'next' ;-)\n\nAh, one thing I forgot to mention.  Some of the tests updated in\nthis series are unhappy with Dscho's \"drive 'am' directly from the\nbuilt-in code, bypassing git-rebase--am.sh scriptlet\" topic.\n\n\n"},{"id":"366285","messageId":"CABPp-BFckuONYcGGkCY3BuPypRULmhsk_OFHyYA2E4jM66BfeQ@mail.gmail.com","threadId":"49781","inReplyTo":"xmqqzhsc6xdk.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-07T20:39:42Z","receivedAt":"2019-01-07T20:39:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi,\n\nOn Mon, Jan 7, 2019 at 12:11 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > Elijah Newren <newren@gmail.com> writes:\n> >\n> >> On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n> >>>\n> >>> This series continues the work of making rebase more self-consistent\n> >>> by removing inconsistencies between different backends.  In\n> >>> particular, this series focuses on making the merge machinery behave\n> >>> like the interactive machinery (though a few differences between the am\n> >>> and interactive backends are also fixed along the way), and ultimately\n> >>> removes the merge backend in favor of reimplementing the relevant\n> >>> options on top of the interactive machinery.\n> >>\n> >> Friendly ping...let me know if you want me to simply resend v4.\n> >>\n> >\n> > If you have anything newer than 90673135 (\"rebase: Implement --merge\n> > via the interactive machinery\", 2018-12-11), then yeah, I haven't\n> > seen it.\n> >\n> > Thanks.\n> >\n> > P.S. even if that one is latest, I would need to downcase Implement\n> > before it hits 'next' ;-)\n>\n> Ah, one thing I forgot to mention.  Some of the tests updated in\n> this series are unhappy with Dscho's \"drive 'am' directly from the\n> built-in code, bypassing git-rebase--am.sh scriptlet\" topic.\n\n2018-12-11 is the newest (and is almost the same as the version from\nmid November); it's just been waiting for review.  I'll fix up the\ncasing of 'Implement' along with any other feedback, if any...maybe\nincluding rebasing on Dscho's series depending on how he wants to take\nit.\n\n\nDscho: Looks like our series conflicts slightly.  Would you like me to\nrebase mine on top of yours and squash the following change into\ncommit c91c944a068e (\"rebase: define linearization ordering and\nenforce it\", 2018-12-11), or do you want to rebase your series on mine\nand either make a new commit out of this change or squash it in\nsomewhere?\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 0317280f83..54023547ff 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -578,7 +578,8 @@ static int run_am(struct rebase_options *opts)\n        argv_array_pushl(&format_patch.args, \"format-patch\", \"-k\", \"--stdout\",\n                         \"--full-index\", \"--cherry-pick\", \"--right-only\",\n                         \"--src-prefix=a/\", \"--dst-prefix=b/\", \"--no-renames\",\n-                        \"--no-cover-letter\", \"--pretty=mboxrd\", NULL);\n+                        \"--no-cover-letter\", \"--pretty=mboxrd\",\n+                        \"--topo-order\", NULL);\n        if (opts->git_format_patch_opt.len)\n                argv_array_split(&format_patch.args,\n                                 opts->git_format_patch_opt.buf);\n\n\nElijah\n"},{"id":"366569","messageId":"CABPp-BHbCnhLypi0Ov_dVUWwqzW7Yho4-G7w=eHVLkJvT6kELg@mail.gmail.com","threadId":"49781","inReplyTo":"CABPp-BFckuONYcGGkCY3BuPypRULmhsk_OFHyYA2E4jM66BfeQ@mail.gmail.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-11T18:36:38Z","receivedAt":"2019-01-11T18:36:54Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Junio,\n\nA small update...\n\nOn Mon, Jan 7, 2019 at 12:39 PM Elijah Newren <newren@gmail.com> wrote:\n> On Mon, Jan 7, 2019 at 12:11 PM Junio C Hamano <gitster@pobox.com> wrote:\n> > Junio C Hamano <gitster@pobox.com> writes:\n> >\n> > > Elijah Newren <newren@gmail.com> writes:\n> > >\n> > >> On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n> > >>>\n> > >>> This series continues the work of making rebase more self-consistent\n> > >>> by removing inconsistencies between different backends.  In\n....\n> > > P.S. even if that one is latest, I would need to downcase Implement\n> > > before it hits 'next' ;-)\n...\n> > Ah, one thing I forgot to mention.  Some of the tests updated in\n> > this series are unhappy with Dscho's \"drive 'am' directly from the\n> > built-in code, bypassing git-rebase--am.sh scriptlet\" topic.\n\nIt looks like you've already done the downcasing in pu; thanks.  Also,\nDscho told me in private email that:\n\n    \"FWIW I am fine with your patches going in first, and I would rebase mine\non top. It will take me probably until next week to get to my patch\nseries and Junio's comments, anyway.\"\n\nSo, I'm guessing that means he'll apply my patch below to his series.\nAs such, other than maybe wait for folks to review my updated series,\nI'm not aware of any further changes I need to make to the\nen/rebase-merge-on-sequencer topic.\n\n> Dscho: Looks like our series conflicts slightly.  Would you like me to\n> rebase mine on top of yours and squash the following change into\n> commit c91c944a068e (\"rebase: define linearization ordering and\n> enforce it\", 2018-12-11), or do you want to rebase your series on mine\n> and either make a new commit out of this change or squash it in\n> somewhere?\n>\n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 0317280f83..54023547ff 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -578,7 +578,8 @@ static int run_am(struct rebase_options *opts)\n>         argv_array_pushl(&format_patch.args, \"format-patch\", \"-k\", \"--stdout\",\n>                          \"--full-index\", \"--cherry-pick\", \"--right-only\",\n>                          \"--src-prefix=a/\", \"--dst-prefix=b/\", \"--no-renames\",\n> -                        \"--no-cover-letter\", \"--pretty=mboxrd\", NULL);\n> +                        \"--no-cover-letter\", \"--pretty=mboxrd\",\n> +                        \"--topo-order\", NULL);\n>         if (opts->git_format_patch_opt.len)\n>                 argv_array_split(&format_patch.args,\n>                                  opts->git_format_patch_opt.buf);\n>\n>\n> Elijah\n"},{"id":"367094","messageId":"nycvar.QRO.7.76.6.1901181434520.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"CABPp-BFckuONYcGGkCY3BuPypRULmhsk_OFHyYA2E4jM66BfeQ@mail.gmail.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-18T13:36:34Z","receivedAt":"2019-01-18T13:36:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Mon, 7 Jan 2019, Elijah Newren wrote:\n\n> On Mon, Jan 7, 2019 at 12:11 PM Junio C Hamano <gitster@pobox.com> wrote:\n> >\n> > Junio C Hamano <gitster@pobox.com> writes:\n> >\n> > > Elijah Newren <newren@gmail.com> writes:\n> > >\n> > >> On Tue, Dec 11, 2018 at 8:11 AM Elijah Newren <newren@gmail.com> wrote:\n> > >>>\n> > >>> This series continues the work of making rebase more self-consistent\n> > >>> by removing inconsistencies between different backends.  In\n> > >>> particular, this series focuses on making the merge machinery behave\n> > >>> like the interactive machinery (though a few differences between the am\n> > >>> and interactive backends are also fixed along the way), and ultimately\n> > >>> removes the merge backend in favor of reimplementing the relevant\n> > >>> options on top of the interactive machinery.\n> > >>\n> > >> Friendly ping...let me know if you want me to simply resend v4.\n> > >>\n> > >\n> > > If you have anything newer than 90673135 (\"rebase: Implement --merge\n> > > via the interactive machinery\", 2018-12-11), then yeah, I haven't\n> > > seen it.\n> > >\n> > > Thanks.\n> > >\n> > > P.S. even if that one is latest, I would need to downcase Implement\n> > > before it hits 'next' ;-)\n> >\n> > Ah, one thing I forgot to mention.  Some of the tests updated in\n> > this series are unhappy with Dscho's \"drive 'am' directly from the\n> > built-in code, bypassing git-rebase--am.sh scriptlet\" topic.\n> \n> 2018-12-11 is the newest (and is almost the same as the version from\n> mid November); it's just been waiting for review.  I'll fix up the\n> casing of 'Implement' along with any other feedback, if any...maybe\n> including rebasing on Dscho's series depending on how he wants to take\n> it.\n> \n> \n> Dscho: Looks like our series conflicts slightly.  Would you like me to\n> rebase mine on top of yours and squash the following change into\n> commit c91c944a068e (\"rebase: define linearization ordering and\n> enforce it\", 2018-12-11), or do you want to rebase your series on mine\n> and either make a new commit out of this change or squash it in\n> somewhere?\n> \n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 0317280f83..54023547ff 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -578,7 +578,8 @@ static int run_am(struct rebase_options *opts)\n>         argv_array_pushl(&format_patch.args, \"format-patch\", \"-k\", \"--stdout\",\n>                          \"--full-index\", \"--cherry-pick\", \"--right-only\",\n>                          \"--src-prefix=a/\", \"--dst-prefix=b/\", \"--no-renames\",\n> -                        \"--no-cover-letter\", \"--pretty=mboxrd\", NULL);\n> +                        \"--no-cover-letter\", \"--pretty=mboxrd\",\n> +                        \"--topo-order\", NULL);\n>         if (opts->git_format_patch_opt.len)\n>                 argv_array_split(&format_patch.args,\n>                                  opts->git_format_patch_opt.buf);\n\nI can easily squash that in. Thank you!\nDscho\n\n> \n> \n> Elijah\n> \n> \n"},{"id":"367100","messageId":"nycvar.QRO.7.76.6.1901181519230.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901181434520.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-18T14:22:36Z","receivedAt":"2019-01-18T14:23:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Fri, 18 Jan 2019, Johannes Schindelin wrote:\n\n> On Mon, 7 Jan 2019, Elijah Newren wrote:\n> \n> > Dscho: Looks like our series conflicts slightly.  Would you like me to\n> > rebase mine on top of yours and squash the following change into\n> > commit c91c944a068e (\"rebase: define linearization ordering and\n> > enforce it\", 2018-12-11), or do you want to rebase your series on mine\n> > and either make a new commit out of this change or squash it in\n> > somewhere?\n> > \n> > diff --git a/builtin/rebase.c b/builtin/rebase.c\n> > index 0317280f83..54023547ff 100644\n> > --- a/builtin/rebase.c\n> > +++ b/builtin/rebase.c\n> > @@ -578,7 +578,8 @@ static int run_am(struct rebase_options *opts)\n> >         argv_array_pushl(&format_patch.args, \"format-patch\", \"-k\", \"--stdout\",\n> >                          \"--full-index\", \"--cherry-pick\", \"--right-only\",\n> >                          \"--src-prefix=a/\", \"--dst-prefix=b/\", \"--no-renames\",\n> > -                        \"--no-cover-letter\", \"--pretty=mboxrd\", NULL);\n> > +                        \"--no-cover-letter\", \"--pretty=mboxrd\",\n> > +                        \"--topo-order\", NULL);\n> >         if (opts->git_format_patch_opt.len)\n> >                 argv_array_split(&format_patch.args,\n> >                                  opts->git_format_patch_opt.buf);\n> \n> I can easily squash that in.\n\nActually, I take that back. This is tested-for in the regression test\nsuite, and I need to keep the built-in and the scripted rebase in sync for\nthat test suite to pass, so that single-liner would incur more changes\nthan I am comfortable with adopting into the builtin-rebase--am patch\nseries...\n\nI am about to submit a new iteration of my patch series, would it be too\nmuch trouble for you to rebase on top? If it would be, let me know, then I\nwill rebase on top of yours.\n\nCiao,\nDscho\n"},{"id":"367119","messageId":"xmqqmunxluj8.fsf@gitster-ct.c.googlers.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901181519230.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-18T17:55:55Z","receivedAt":"2019-01-18T17:56:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> I am about to submit a new iteration of my patch series, would it be too\n> much trouble for you to rebase on top? If it would be, let me know, then I\n> will rebase on top of yours.\n\nOr both of you keep the topics as-is and self-consistent, and let\nthe rerere machinery to squash it in when the two topics gets\nmerged.\n\n"},{"id":"367122","messageId":"CABPp-BFRkg7HShJ-Noh=GKJUCh7TO7NpveX5Yy8Pv+1wZiH3qA@mail.gmail.com","threadId":"49781","inReplyTo":"xmqqmunxluj8.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-18T18:07:04Z","receivedAt":"2019-01-18T18:07:19Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Jan 18, 2019 at 9:55 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n> > I am about to submit a new iteration of my patch series, would it be too\n> > much trouble for you to rebase on top? If it would be, let me know, then I\n> > will rebase on top of yours.\n>\n> Or both of you keep the topics as-is and self-consistent, and let\n> the rerere machinery to squash it in when the two topics gets\n> merged.\n\nYeah, I see that commit 8d808e12a2cc (\"Merge branch 'js/rebase-am'\ninto jch\", 2019-01-17) has my fix squashed in; thanks Junio.\n\nI'm happy to do whatever is needed with en/rebase-merge-on-sequencer\nthat makes it easiest for everyone else.  I'm assuming right now that\nthere's nothing I should do to improve it, but if anyone wants me to\nrebase it or fix something up, just let me know.\n"},{"id":"367143","messageId":"nycvar.QRO.7.76.6.1901182203350.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"xmqqmunxluj8.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-18T21:03:58Z","receivedAt":"2019-01-18T21:04:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Fri, 18 Jan 2019, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > I am about to submit a new iteration of my patch series, would it be too\n> > much trouble for you to rebase on top? If it would be, let me know, then I\n> > will rebase on top of yours.\n> \n> Or both of you keep the topics as-is and self-consistent, and let\n> the rerere machinery to squash it in when the two topics gets\n> merged.\n\nWith all the experience I have with rerere, I don't trust it.\n\nCiao,\nJohannes\n"},{"id":"367144","messageId":"xmqqtvi5irv9.fsf@gitster-ct.c.googlers.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901182203350.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-18T21:21:46Z","receivedAt":"2019-01-18T21:21:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi Junio,\n>\n> On Fri, 18 Jan 2019, Junio C Hamano wrote:\n>\n>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> \n>> > I am about to submit a new iteration of my patch series, would it be too\n>> > much trouble for you to rebase on top? If it would be, let me know, then I\n>> > will rebase on top of yours.\n>> \n>> Or both of you keep the topics as-is and self-consistent, and let\n>> the rerere machinery to squash it in when the two topics gets\n>> merged.\n>\n> With all the experience I have with rerere, I don't trust it.\n\nFWIW, I trust it once I got right resolution better than randomly\nrebased resubmission that needs to be re-reviewed afresh.\n"},{"id":"367243","messageId":"nycvar.QRO.7.76.6.1901211702380.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T16:03:21Z","receivedAt":"2019-01-21T16:03:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Tue, 11 Dec 2018, Elijah Newren wrote:\n\n> Differences since v3 (full range-diff below):\n>   - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n>     out by Duy\n>   - Rebased on 2.20.0\n\n    - Fixed the \"comptable\" tyop\n\nThis, and the range-diff, look reasonable to me.\n\nThanks,\nDscho\n\n> Elijah Newren (8):\n>   rebase: make builtin and legacy script error messages the same\n>   rebase: fix incompatible options error message\n>   t5407: add a test demonstrating how interactive handles --skip\n>     differently\n>   am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n>   git-rebase, sequencer: extend --quiet option for the interactive\n>     machinery\n>   git-legacy-rebase: simplify unnecessary triply-nested if\n>   rebase: define linearization ordering and enforce it\n>   rebase: Implement --merge via the interactive machinery\n> \n>  .gitignore                        |   1 -\n>  Documentation/git-rebase.txt      |  17 +---\n>  Makefile                          |   1 -\n>  builtin/am.c                      |   9 ++\n>  builtin/rebase.c                  |  30 ++----\n>  git-legacy-rebase.sh              |  65 ++++++------\n>  git-rebase--am.sh                 |   2 +-\n>  git-rebase--common.sh             |   2 +-\n>  git-rebase--merge.sh              | 164 ------------------------------\n>  sequencer.c                       |  23 +++--\n>  sequencer.h                       |   1 +\n>  t/t3406-rebase-message.sh         |   7 +-\n>  t/t3420-rebase-autostash.sh       |  78 ++------------\n>  t/t3421-rebase-topology-linear.sh |  10 +-\n>  t/t3425-rebase-topology-merges.sh |  15 ++-\n>  t/t5407-post-rewrite-hook.sh      |  34 +++++++\n>  t/t9903-bash-prompt.sh            |   2 +-\n>  17 files changed, 121 insertions(+), 340 deletions(-)\n>  delete mode 100644 git-rebase--merge.sh\n> \n> Range-diff:\n> -:  ---------- > 1:  2e8b1bcb8b rebase: make builtin and legacy script error messages the same\n> 1:  2f4bdd1980 ! 2:  eba87828c6 rebase: fix incompatible options error message\n>     @@ -9,12 +9,12 @@\n>          understood by separate backends were used:\n>      \n>          $ git rebase --keep --ignore-whitespace\n>     -    fatal: error: cannot combine interactive options (--interactive, --exec,\n>     +    fatal: cannot combine interactive options (--interactive, --exec,\n>          --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n>          am options (.git/rebase-apply/applying)\n>      \n>          $ git rebase --merge --ignore-whitespace\n>     -    fatal: error: cannot combine merge options (--merge, --strategy,\n>     +    fatal: cannot combine merge options (--merge, --strategy,\n>          --strategy-option) with am options (.git/rebase-apply/applying)\n>      \n>          Note that in both cases, the list of \"am options\" is\n>     @@ -33,18 +33,17 @@\n>       \t\t\t\tbreak;\n>       \n>       \t\tif (is_interactive(&options) && i >= 0)\n>     --\t\t\tdie(_(\"error: cannot combine interactive options \"\n>     +-\t\t\tdie(_(\"cannot combine interactive options \"\n>      -\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n>      -\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n>      -\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n>     -+\t\t\tdie(_(\"error: cannot combine am options \"\n>     ++\t\t\tdie(_(\"cannot combine am options \"\n>      +\t\t\t      \"with interactive options\"));\n>       \t\tif (options.type == REBASE_MERGE && i >= 0)\n>     --\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n>     +-\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n>      -\t\t\t      \"--strategy, --strategy-option) with am options \"\n>      -\t\t\t      \"(%s)\"), buf.buf);\n>     -+\t\t\tdie(_(\"error: cannot combine am options \"\n>     -+\t\t\t      \"with merge options \"));\n>     ++\t\t\tdie(_(\"cannot combine am options with merge options \"));\n>       \t}\n>       \n>       \tif (options.signoff) {\n>     @@ -56,15 +55,15 @@\n>       \tthen\n>       \t\tif test -n \"$incompatible_opts\"\n>       \t\tthen\n>     --\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n>     -+\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n>     +-\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n>     ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n>       \t\tfi\n>       \tfi\n>       \tif test -n \"$do_merge\"; then\n>       \t\tif test -n \"$incompatible_opts\"\n>       \t\tthen\n>     --\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n>     -+\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n>     +-\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n>     ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n>       \t\tfi\n>       \tfi\n>       fi\n> 2:  cc33a8ccc1 = 3:  15d929edb2 t5407: add a test demonstrating how interactive handles --skip differently\n> 3:  f5838ef763 = 4:  c9d6d5141e am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n> 4:  50dc863d9f = 5:  0b19ad8e2d git-rebase, sequencer: extend --quiet option for the interactive machinery\n> 5:  35cf552f27 ! 6:  5ded8654ec git-legacy-rebase: simplify unnecessary triply-nested if\n>     @@ -18,7 +18,7 @@\n>          moving the innermost conditional to the outside, allowing us to remove\n>          the test on git_am_opt entirely and giving us the following form:\n>      \n>     -    if incomptable_opts:\n>     +    if incompatible_opts:\n>            if interactive:\n>              show_error_about_interactive_and_am_incompatibilities\n>            if rebase-merge:\n>     @@ -44,18 +44,18 @@\n>       \tthen\n>      -\t\tif test -n \"$incompatible_opts\"\n>      -\t\tthen\n>     --\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n>     +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n>      -\t\tfi\n>     -+\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n>     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n>       \tfi\n>      -\tif test -n \"$do_merge\"; then\n>      -\t\tif test -n \"$incompatible_opts\"\n>      -\t\tthen\n>     --\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n>     +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n>      -\t\tfi\n>      +\tif test -n \"$do_merge\"\n>      +\tthen\n>     -+\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n>     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n>       \tfi\n>       fi\n>       \n> 6:  2a3d8ff1c1 = 7:  bb8e5a4527 rebase: define linearization ordering and enforce it\n> 7:  58371d377a ! 8:  5de428d695 rebase: Implement --merge via the interactive machinery\n>     @@ -142,14 +142,15 @@\n>       \t\timply_interactive(&options, \"--root without --onto\");\n>       \n>      @@\n>     + \t\t\t\tbreak;\n>       \n>       \t\tif (is_interactive(&options) && i >= 0)\n>     - \t\t\tdie(_(\"error: cannot combine am options \"\n>     +-\t\t\tdie(_(\"cannot combine am options \"\n>      -\t\t\t      \"with interactive options\"));\n>      -\t\tif (options.type == REBASE_MERGE && i >= 0)\n>     --\t\t\tdie(_(\"error: cannot combine am options \"\n>     --\t\t\t      \"with merge options \"));\n>     -+\t\t\t      \"with either interactive or merge options\"));\n>     +-\t\t\tdie(_(\"cannot combine am options with merge options \"));\n>     ++\t\t\tdie(_(\"cannot combine am options with either \"\n>     ++\t\t\t      \"interactive or merge options\"));\n>       \t}\n>       \n>       \tif (options.signoff) {\n>     @@ -205,13 +206,13 @@\n>       then\n>      -\tif test -n \"$interactive_rebase\"\n>      -\tthen\n>     --\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n>     +-\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n>      -\tfi\n>      -\tif test -n \"$do_merge\"\n>      +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n>       \tthen\n>     --\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n>     -+\t\tdie \"$(gettext \"error: cannot combine am options with either interactive or merge options\")\"\n>     +-\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n>     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with either interactive or merge options\")\"\n>       \tfi\n>       fi\n>       \n>     @@ -225,7 +226,7 @@\n>       \t# linear history?\n>       \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n>      @@\n>     - \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n>     + \tGIT_PAGER='' git diff --stat --summary \"$mb_tree\" \"$onto\"\n>       fi\n>       \n>      +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n> -- \n> 2.20.0.8.g5de428d695\n> \n> \n"},{"id":"367244","messageId":"nycvar.QRO.7.76.6.1901211706250.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181211161139.31686-5-newren@gmail.com","subject":"Re: [PATCH v4 4/8] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T16:07:36Z","receivedAt":"2019-01-21T16:08:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 11 Dec 2018, Elijah Newren wrote:\n\n> The post-rewrite hook is supposed to be invoked for each rewritten\n> commit.  The fact that a commit was selected and processed by the rebase\n> operation (even though when we hit an error a user said it had no more\n> useful changes), suggests we should write an entry for it.  In\n> particular, let's treat it as an empty commit trivially squashed into\n> its parent.\n> \n> This brings the rebase--am and rebase--merge backends in sync with the\n> behavior of the interactive rebase backend.\n> \n> Signed-off-by: Elijah Newren <newren@gmail.com>\n\nThis makes sense. I think, though, that we need to be more careful...\n\n> ---\n>  builtin/am.c                 | 9 +++++++++\n>  git-rebase--merge.sh         | 2 ++\n>  t/t5407-post-rewrite-hook.sh | 3 +++\n>  3 files changed, 14 insertions(+)\n> \n> diff --git a/builtin/am.c b/builtin/am.c\n> index 8f27f3375b..af9d034838 100644\n> --- a/builtin/am.c\n> +++ b/builtin/am.c\n> @@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n>  \tif (clean_index(&head, &head))\n>  \t\tdie(_(\"failed to clean index\"));\n>  \n> +\tif (state->rebasing) {\n> +\t\tFILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n> +\n> +\t\tassert(!is_null_oid(&state->orig_commit));\n> +\t\tfprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n\n... here. What if `fp == NULL`? (Users do all kinds of interesting\nthings...)\n\nCiao,\nDscho\n\n> +\t\tfprintf(fp, \"%s\\n\", oid_to_hex(&head));\n> +\t\tfclose(fp);\n> +\t}\n> +\n>  \tam_next(state);\n>  \tam_load(state);\n>  \tam_run(state, 0);\n> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n> index aa2f2f0872..91250cbaed 100644\n> --- a/git-rebase--merge.sh\n> +++ b/git-rebase--merge.sh\n> @@ -121,6 +121,8 @@ continue)\n>  skip)\n>  \tread_state\n>  \tgit rerere clear\n> +\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n> +\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n>  \tmsgnum=$(($msgnum + 1))\n>  \twhile test \"$msgnum\" -le \"$end\"\n>  \tdo\n> diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\n> index 6426ec8991..a4a5903cba 100755\n> --- a/t/t5407-post-rewrite-hook.sh\n> +++ b/t/t5407-post-rewrite-hook.sh\n> @@ -78,6 +78,7 @@ test_expect_success 'git rebase --skip' '\n>  \tgit rebase --continue &&\n>  \techo rebase >expected.args &&\n>  \tcat >expected.data <<-EOF &&\n> +\t$(git rev-parse C) $(git rev-parse HEAD^)\n>  \t$(git rev-parse D) $(git rev-parse HEAD)\n>  \tEOF\n>  \tverify_hook_input\n> @@ -91,6 +92,7 @@ test_expect_success 'git rebase --skip the last one' '\n>  \techo rebase >expected.args &&\n>  \tcat >expected.data <<-EOF &&\n>  \t$(git rev-parse E) $(git rev-parse HEAD)\n> +\t$(git rev-parse F) $(git rev-parse HEAD)\n>  \tEOF\n>  \tverify_hook_input\n>  '\n> @@ -120,6 +122,7 @@ test_expect_success 'git rebase -m --skip' '\n>  \tgit rebase --continue &&\n>  \techo rebase >expected.args &&\n>  \tcat >expected.data <<-EOF &&\n> +\t$(git rev-parse C) $(git rev-parse HEAD^)\n>  \t$(git rev-parse D) $(git rev-parse HEAD)\n>  \tEOF\n>  \tverify_hook_input\n> -- \n> 2.20.0.8.g5de428d695\n> \n> \n"},{"id":"367245","messageId":"nycvar.QRO.7.76.6.1901211709090.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"20181211161139.31686-6-newren@gmail.com","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T16:10:28Z","receivedAt":"2019-01-21T16:10:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Tue, 11 Dec 2018, Elijah Newren wrote:\n\n> While 'quiet' and 'interactive' may sound like antonyms, the interactive\n> machinery actually has logic that implements several\n> interactive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\n> which won't pop up an editor.  The rewrite of interactive rebase in C\n> added a quiet option, though it only turns stats off.  Since we want to\n> make the interactive machinery also take over for git-rebase--merge, it\n> should fully implement the --quiet option.\n> \n> git-rebase--interactive was already somewhat quieter than\n> git-rebase--merge and git-rebase--am, possibly because cherry-pick has\n> just traditionally been quieter.  As such, we only drop a few\n> informational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n> \n> Also, for simplicity, remove the differences in how quiet and verbose\n> options were recorded.  Having one be signalled by the presence of a\n> \"verbose\" file in the state_dir, while the other was signalled by the\n> contents of a \"quiet\" file was just weirdly inconsistent.  (This\n> inconsistency pre-dated the rewrite into C.)  Make them consistent by\n> having them both key off the presence of the file.\n> \n> Signed-off-by: Elijah Newren <newren@gmail.com>\n\nThis is convincing. I would like to point out, though...\n\n> ---\n>  builtin/rebase.c      |  5 +----\n>  git-legacy-rebase.sh  |  2 +-\n>  git-rebase--common.sh |  2 +-\n>  sequencer.c           | 23 +++++++++++++----------\n>  sequencer.h           |  1 +\n>  5 files changed, 17 insertions(+), 16 deletions(-)\n> \n> diff --git a/builtin/rebase.c b/builtin/rebase.c\n> index 78e982298f..ec2e5fbf23 100644\n> --- a/builtin/rebase.c\n> +++ b/builtin/rebase.c\n> @@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n>  \tif (get_oid(buf.buf, &opts->orig_head))\n>  \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n>  \n> -\tstrbuf_reset(&buf);\n> -\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n> -\t\treturn -1;\n> -\tif (buf.len)\n> +\tif (file_exists(state_dir_path(\"quiet\", opts)))\n\nThis changes the behavior. AFAIR the `quiet` file was always written, but\ncontained `t` in quiet mode. I have to interrupt my review here, and will\ncontinue later, but maybe you will beat me to looking into that.\n\nCiao,\nDscho\n\n>  \t\topts->flags &= ~REBASE_NO_QUIET;\n>  \telse\n>  \t\topts->flags |= REBASE_NO_QUIET;\n> diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\n> index fccb33b959..f4088b7bda 100755\n> --- a/git-legacy-rebase.sh\n> +++ b/git-legacy-rebase.sh\n> @@ -113,7 +113,7 @@ read_basic_state () {\n>  \telse\n>  \t\torig_head=$(cat \"$state_dir\"/head)\n>  \tfi &&\n> -\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n> +\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n>  \ttest -f \"$state_dir\"/verbose && verbose=t\n>  \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n>  \ttest -f \"$state_dir\"/strategy_opts &&\n> diff --git a/git-rebase--common.sh b/git-rebase--common.sh\n> index 7e39d22871..dc18c682fa 100644\n> --- a/git-rebase--common.sh\n> +++ b/git-rebase--common.sh\n> @@ -10,7 +10,7 @@ write_basic_state () {\n>  \techo \"$head_name\" > \"$state_dir\"/head-name &&\n>  \techo \"$onto\" > \"$state_dir\"/onto &&\n>  \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n> -\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n> +\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n>  \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n>  \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n>  \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\n> diff --git a/sequencer.c b/sequencer.c\n> index e1a4dd15f1..bc25615050 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n>  static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n>  static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n>  static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n> +static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n>  static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n>  static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n>  static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n> @@ -157,7 +158,6 @@ 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> -static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n>  \n>  static int git_sequencer_config(const char *k, const char *v, void *cb)\n>  {\n> @@ -2357,6 +2357,9 @@ static int read_populate_opts(struct replay_opts *opts)\n>  \t\tif (file_exists(rebase_path_verbose()))\n>  \t\t\topts->verbose = 1;\n>  \n> +\t\tif (file_exists(rebase_path_quiet()))\n> +\t\t\topts->quiet = 1;\n> +\n>  \t\tif (file_exists(rebase_path_signoff())) {\n>  \t\t\topts->allow_ff = 0;\n>  \t\t\topts->signoff = 1;\n> @@ -2424,9 +2427,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n>  \n>  \tif (quiet)\n>  \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n> -\telse\n> -\t\twrite_file(rebase_path_quiet(), \"\\n\");\n> -\n>  \tif (opts->verbose)\n>  \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n>  \tif (opts->strategy)\n> @@ -3503,10 +3503,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n>  \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n>  \t\t\t\t\tfclose(f);\n>  \t\t\t\t}\n> -\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n> -\t\t\t\t\ttodo_list->done_nr,\n> -\t\t\t\t\ttodo_list->total_nr,\n> -\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n> +\t\t\t\tif (!opts->quiet)\n> +\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n> +\t\t\t\t\t\ttodo_list->done_nr,\n> +\t\t\t\t\t\ttodo_list->total_nr,\n> +\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n>  \t\t\t}\n>  \t\t\tunlink(rebase_path_message());\n>  \t\t\tunlink(rebase_path_author_script());\n> @@ -3738,8 +3739,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n>  \t\t}\n>  \t\tapply_autostash(opts);\n>  \n> -\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n> -\t\t\thead_ref.buf);\n> +\t\tif (!opts->quiet)\n> +\t\t\tfprintf(stderr,\n> +\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n> +\t\t\t\thead_ref.buf);\n>  \n>  \t\tstrbuf_release(&buf);\n>  \t\tstrbuf_release(&head_ref);\n> diff --git a/sequencer.h b/sequencer.h\n> index 5071a73563..729222b583 100644\n> --- a/sequencer.h\n> +++ b/sequencer.h\n> @@ -39,6 +39,7 @@ struct replay_opts {\n>  \tint allow_empty_message;\n>  \tint keep_redundant_commits;\n>  \tint verbose;\n> +\tint quiet;\n>  \n>  \tint mainline;\n>  \n> -- \n> 2.20.0.8.g5de428d695\n> \n> \n"},{"id":"367246","messageId":"CABPp-BFrgjW-c8NKGYKs1VaH--Oc8yUu0enQMSp1pQVUwBOBwA@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901211709090.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-21T17:50:25Z","receivedAt":"2019-01-21T17:50:41Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Dscho,\n\nOn Mon, Jan 21, 2019 at 8:10 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Hi Elijah,\n>\n> On Tue, 11 Dec 2018, Elijah Newren wrote:\n>\n> > While 'quiet' and 'interactive' may sound like antonyms, the interactive\n> > machinery actually has logic that implements several\n> > interactive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\n> > which won't pop up an editor.  The rewrite of interactive rebase in C\n> > added a quiet option, though it only turns stats off.  Since we want to\n> > make the interactive machinery also take over for git-rebase--merge, it\n> > should fully implement the --quiet option.\n> >\n> > git-rebase--interactive was already somewhat quieter than\n> > git-rebase--merge and git-rebase--am, possibly because cherry-pick has\n> > just traditionally been quieter.  As such, we only drop a few\n> > informational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n> >\n> > Also, for simplicity, remove the differences in how quiet and verbose\n> > options were recorded.  Having one be signalled by the presence of a\n> > \"verbose\" file in the state_dir, while the other was signalled by the\n> > contents of a \"quiet\" file was just weirdly inconsistent.  (This\n> > inconsistency pre-dated the rewrite into C.)  Make them consistent by\n> > having them both key off the presence of the file.\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n>\n> This is convincing. I would like to point out, though...\n>\n> > ---\n> >  builtin/rebase.c      |  5 +----\n> >  git-legacy-rebase.sh  |  2 +-\n> >  git-rebase--common.sh |  2 +-\n> >  sequencer.c           | 23 +++++++++++++----------\n> >  sequencer.h           |  1 +\n> >  5 files changed, 17 insertions(+), 16 deletions(-)\n> >\n> > diff --git a/builtin/rebase.c b/builtin/rebase.c\n> > index 78e982298f..ec2e5fbf23 100644\n> > --- a/builtin/rebase.c\n> > +++ b/builtin/rebase.c\n> > @@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n> >       if (get_oid(buf.buf, &opts->orig_head))\n> >               return error(_(\"invalid orig-head: '%s'\"), buf.buf);\n> >\n> > -     strbuf_reset(&buf);\n> > -     if (read_one(state_dir_path(\"quiet\", opts), &buf))\n> > -             return -1;\n> > -     if (buf.len)\n> > +     if (file_exists(state_dir_path(\"quiet\", opts)))\n>\n> This changes the behavior. AFAIR the `quiet` file was always written, but\n> contained `t` in quiet mode. I have to interrupt my review here, and will\n> continue later, but maybe you will beat me to looking into that.\n>\n> Ciao,\n> Dscho\n\nYou are certainly consistent; you commented on this exact same issue\nin both v1 and v2 (you didn't have time to review v3). In v2, your\ncomment was[1]:\n\n\"\nI am slightly concerned that some creative power user could have written\nscripts that rely on this behavior.\n\nBut only *slightly* concerned.\n\nThe patch looks correct.\n\"\n\nAlso, I have a fuzzy memory of discussing a very similar case with\nsome rebase-oriented option and its on-disk representation, where the\nconcern was more about users upgrading git versions during an\nincomplete rebase rather than power users looking at internal file\ncontents.  And I think either Phillip or Junio made some statement\nabout considering these internal details and that they felt the worry\nabout upgrade mid-rebase was overly worrying.  But I can't find the\nemails right now, and it's been so long (at least half a year) that I\nmight be imagining things.\n\nBut from first principles, in this case even if you're worried about\npower users reaching into internal files of rebase or about users\nupgrade mid-rebase, at *worst* people will get or lose a few fluffy\nprogress-update messages.  To me, that's an innocuous level of change\nthat's certainly worth the risk to allow us to get rid of the annoying\ndifferences in implementation of handling of different options.  But,\nif you strongly feel that's too big a risk, we can remove the part of\nthe patch making verbose and quiet be handled consistently; it's not\ncritical to the rest of the series.  I just thought it was a good\ncleanup while I was touching the area.\n\nElijah\n\n[1] https://public-inbox.org/git/nycvar.QRO.7.76.6.1811121610350.39@tvgsbejvaqbjf.bet/\n"},{"id":"367247","messageId":"CABPp-BGOPQms5CRvQ_+iMs=8-tgvw=cyJaT1OCKNFHEG+GyAvA@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901211706250.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 4/8] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-21T17:59:37Z","receivedAt":"2019-01-21T17:59:52Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Dscho,\n\nOn Mon, Jan 21, 2019 at 8:07 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Hi,\n>\n> On Tue, 11 Dec 2018, Elijah Newren wrote:\n>\n> > The post-rewrite hook is supposed to be invoked for each rewritten\n> > commit.  The fact that a commit was selected and processed by the rebase\n> > operation (even though when we hit an error a user said it had no more\n> > useful changes), suggests we should write an entry for it.  In\n> > particular, let's treat it as an empty commit trivially squashed into\n> > its parent.\n> >\n> > This brings the rebase--am and rebase--merge backends in sync with the\n> > behavior of the interactive rebase backend.\n> >\n> > Signed-off-by: Elijah Newren <newren@gmail.com>\n>\n> This makes sense. I think, though, that we need to be more careful...\n>\n> > ---\n> >  builtin/am.c                 | 9 +++++++++\n> >  git-rebase--merge.sh         | 2 ++\n> >  t/t5407-post-rewrite-hook.sh | 3 +++\n> >  3 files changed, 14 insertions(+)\n> >\n> > diff --git a/builtin/am.c b/builtin/am.c\n> > index 8f27f3375b..af9d034838 100644\n> > --- a/builtin/am.c\n> > +++ b/builtin/am.c\n> > @@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n> >       if (clean_index(&head, &head))\n> >               die(_(\"failed to clean index\"));\n> >\n> > +     if (state->rebasing) {\n> > +             FILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n> > +\n> > +             assert(!is_null_oid(&state->orig_commit));\n> > +             fprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n>\n> ... here. What if `fp == NULL`? (Users do all kinds of interesting\n> things...)\n\nThis if-block is actually copy-pasted from the end of the do_commit()\nfunction, since the same logic was needed in both places.  The fact\nthat a `fp == NULL` case never triggered for do_commit() suggests that\nthe check has never been needed in the wild (or perhaps it just\nindicates a latent bug that no one has triggered yet).  However, it\ndoes suggest a code cleanup regardless.  I thought of it as such a\nsmall block that I didn't think to put it in a separate function, but\nperhaps I should so that someone spotting the possibility of a NULL fp\ncould fix it for both callers in a single place.\n\nShould I insert a preliminary change pulling this block out of\ndo_commit into a separate function, and then modify this patch to just\ncall this function?  Or perhaps given the length of time it has\nalready been cooking (and Junio's rerere resolution of our two series\nthat I don't want to mess up), just do it as a simple post-series\nfixup?\n\n\nElijah\n"},{"id":"367248","messageId":"nycvar.QRO.7.76.6.1901211910560.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"CABPp-BGOPQms5CRvQ_+iMs=8-tgvw=cyJaT1OCKNFHEG+GyAvA@mail.gmail.com","subject":"Re: [PATCH v4 4/8] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T18:11:20Z","receivedAt":"2019-01-21T18:11:44Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Mon, 21 Jan 2019, Elijah Newren wrote:\n\n> On Mon, Jan 21, 2019 at 8:07 AM Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > On Tue, 11 Dec 2018, Elijah Newren wrote:\n> >\n> > > The post-rewrite hook is supposed to be invoked for each rewritten\n> > > commit.  The fact that a commit was selected and processed by the rebase\n> > > operation (even though when we hit an error a user said it had no more\n> > > useful changes), suggests we should write an entry for it.  In\n> > > particular, let's treat it as an empty commit trivially squashed into\n> > > its parent.\n> > >\n> > > This brings the rebase--am and rebase--merge backends in sync with the\n> > > behavior of the interactive rebase backend.\n> > >\n> > > Signed-off-by: Elijah Newren <newren@gmail.com>\n> >\n> > This makes sense. I think, though, that we need to be more careful...\n> >\n> > > ---\n> > >  builtin/am.c                 | 9 +++++++++\n> > >  git-rebase--merge.sh         | 2 ++\n> > >  t/t5407-post-rewrite-hook.sh | 3 +++\n> > >  3 files changed, 14 insertions(+)\n> > >\n> > > diff --git a/builtin/am.c b/builtin/am.c\n> > > index 8f27f3375b..af9d034838 100644\n> > > --- a/builtin/am.c\n> > > +++ b/builtin/am.c\n> > > @@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n> > >       if (clean_index(&head, &head))\n> > >               die(_(\"failed to clean index\"));\n> > >\n> > > +     if (state->rebasing) {\n> > > +             FILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n> > > +\n> > > +             assert(!is_null_oid(&state->orig_commit));\n> > > +             fprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n> >\n> > ... here. What if `fp == NULL`? (Users do all kinds of interesting\n> > things...)\n> \n> This if-block is actually copy-pasted from the end of the do_commit()\n> function, since the same logic was needed in both places.  The fact\n> that a `fp == NULL` case never triggered for do_commit() suggests that\n> the check has never been needed in the wild (or perhaps it just\n> indicates a latent bug that no one has triggered yet).  However, it\n> does suggest a code cleanup regardless.  I thought of it as such a\n> small block that I didn't think to put it in a separate function, but\n> perhaps I should so that someone spotting the possibility of a NULL fp\n> could fix it for both callers in a single place.\n> \n> Should I insert a preliminary change pulling this block out of\n> do_commit into a separate function, and then modify this patch to just\n> call this function?  Or perhaps given the length of time it has\n> already been cooking (and Junio's rerere resolution of our two series\n> that I don't want to mess up), just do it as a simple post-series\n> fixup?\n\nSpeaking for myself: I am fine with either way.\n\nCiao,\nDscho\n"},{"id":"367249","messageId":"nycvar.QRO.7.76.6.1901211916400.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"CABPp-BFrgjW-c8NKGYKs1VaH--Oc8yUu0enQMSp1pQVUwBOBwA@mail.gmail.com","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T18:19:36Z","receivedAt":"2019-01-21T18:20:01Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Mon, 21 Jan 2019, Elijah Newren wrote:\n\n> On Mon, Jan 21, 2019 at 8:10 AM Johannes Schindelin\n> <Johannes.Schindelin@gmx.de> wrote:\n> >\n> > On Tue, 11 Dec 2018, Elijah Newren wrote:\n> >\n> > > While 'quiet' and 'interactive' may sound like antonyms, the interactive\n> > > machinery actually has logic that implements several\n> > > interactive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\n> > > which won't pop up an editor.  The rewrite of interactive rebase in C\n> > > added a quiet option, though it only turns stats off.  Since we want to\n> > > make the interactive machinery also take over for git-rebase--merge, it\n> > > should fully implement the --quiet option.\n> > >\n> > > git-rebase--interactive was already somewhat quieter than\n> > > git-rebase--merge and git-rebase--am, possibly because cherry-pick has\n> > > just traditionally been quieter.  As such, we only drop a few\n> > > informational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n> > >\n> > > Also, for simplicity, remove the differences in how quiet and verbose\n> > > options were recorded.  Having one be signalled by the presence of a\n> > > \"verbose\" file in the state_dir, while the other was signalled by the\n> > > contents of a \"quiet\" file was just weirdly inconsistent.  (This\n> > > inconsistency pre-dated the rewrite into C.)  Make them consistent by\n> > > having them both key off the presence of the file.\n> > >\n> > > Signed-off-by: Elijah Newren <newren@gmail.com>\n> >\n> > This is convincing. I would like to point out, though...\n> >\n> > > ---\n> > >  builtin/rebase.c      |  5 +----\n> > >  git-legacy-rebase.sh  |  2 +-\n> > >  git-rebase--common.sh |  2 +-\n> > >  sequencer.c           | 23 +++++++++++++----------\n> > >  sequencer.h           |  1 +\n> > >  5 files changed, 17 insertions(+), 16 deletions(-)\n> > >\n> > > diff --git a/builtin/rebase.c b/builtin/rebase.c\n> > > index 78e982298f..ec2e5fbf23 100644\n> > > --- a/builtin/rebase.c\n> > > +++ b/builtin/rebase.c\n> > > @@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n> > >       if (get_oid(buf.buf, &opts->orig_head))\n> > >               return error(_(\"invalid orig-head: '%s'\"), buf.buf);\n> > >\n> > > -     strbuf_reset(&buf);\n> > > -     if (read_one(state_dir_path(\"quiet\", opts), &buf))\n> > > -             return -1;\n> > > -     if (buf.len)\n> > > +     if (file_exists(state_dir_path(\"quiet\", opts)))\n> >\n> > This changes the behavior. AFAIR the `quiet` file was always written, but\n> > contained `t` in quiet mode. I have to interrupt my review here, and will\n> > continue later, but maybe you will beat me to looking into that.\n> >\n> > Ciao,\n> > Dscho\n> \n> You are certainly consistent;\n\nYou flatter me!\n\n> you commented on this exact same issue in both v1 and v2 (you didn't\n> have time to review v3). In v2, your comment was[1]:\n> \n> \"\n> I am slightly concerned that some creative power user could have written\n> scripts that rely on this behavior.\n> \n> But only *slightly* concerned.\n> \n> The patch looks correct.\n> \"\n> \n> Also, I have a fuzzy memory of discussing a very similar case with\n> some rebase-oriented option and its on-disk representation, where the\n> concern was more about users upgrading git versions during an\n> incomplete rebase rather than power users looking at internal file\n> contents.  And I think either Phillip or Junio made some statement\n> about considering these internal details and that they felt the worry\n> about upgrade mid-rebase was overly worrying.  But I can't find the\n> emails right now, and it's been so long (at least half a year) that I\n> might be imagining things.\n\nIndeed, it was one of Phillip's patch series that fixed an incorrect\nquoting in the author script. And we eventually all agreed that it would\nnot be worth the trouble to take care of upgrade-spanning rebases (both\nPhillip and I spent some time to make it so, IIRC).\n\n> But from first principles, in this case even if you're worried about\n> power users reaching into internal files of rebase or about users\n> upgrade mid-rebase, at *worst* people will get or lose a few fluffy\n> progress-update messages.  To me, that's an innocuous level of change\n> that's certainly worth the risk to allow us to get rid of the annoying\n> differences in implementation of handling of different options.  But,\n> if you strongly feel that's too big a risk, we can remove the part of\n> the patch making verbose and quiet be handled consistently; it's not\n> critical to the rest of the series.  I just thought it was a good\n> cleanup while I was touching the area.\n\nI think you are correct. It is much easier in C to check whether a file\nexists than to read it, parse it and determine whether its Boolean value\nshould be `false` or `true`.\n\nSo color me convinced that your clean-up is worth it. Maybe, just maybe,\nif you submit another iteration (and only if), could you add a little\nparagraph for future Dscho to understand that this clean-up was slipped\nin?\n\nThanks,\nDscho\n"},{"id":"367250","messageId":"nycvar.QRO.7.76.6.1901211921540.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901211916400.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T18:22:30Z","receivedAt":"2019-01-21T18:22:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Mon, 21 Jan 2019, Johannes Schindelin wrote:\n\n> Maybe, just maybe, if you submit another iteration (and only if), could\n> you add a little paragraph for future Dscho to understand that this\n> clean-up was slipped in?\n\nOh wow. I guess I should learn how to read. The last paragraph says\nexactly that. For some reason, I missed that earlier.\n\nSorry for the noise,\nDscho\n"},{"id":"367259","messageId":"nycvar.QRO.7.76.6.1901212200400.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901211702380.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T21:01:13Z","receivedAt":"2019-01-21T21:01:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Elijah,\n\nOn Mon, 21 Jan 2019, Johannes Schindelin wrote:\n\n> On Tue, 11 Dec 2018, Elijah Newren wrote:\n> \n> > Differences since v3 (full range-diff below):\n> >   - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n> >     out by Duy\n> >   - Rebased on 2.20.0\n> \n>     - Fixed the \"comptable\" tyop\n> \n> This, and the range-diff, look reasonable to me.\n\nAnd now that I looked through all 8 patches, those look reasonable to me,\ntoo. I think this is ready for `next`.\n\nCiao,\nDscho\n\n> \n> Thanks,\n> Dscho\n> \n> > Elijah Newren (8):\n> >   rebase: make builtin and legacy script error messages the same\n> >   rebase: fix incompatible options error message\n> >   t5407: add a test demonstrating how interactive handles --skip\n> >     differently\n> >   am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n> >   git-rebase, sequencer: extend --quiet option for the interactive\n> >     machinery\n> >   git-legacy-rebase: simplify unnecessary triply-nested if\n> >   rebase: define linearization ordering and enforce it\n> >   rebase: Implement --merge via the interactive machinery\n> > \n> >  .gitignore                        |   1 -\n> >  Documentation/git-rebase.txt      |  17 +---\n> >  Makefile                          |   1 -\n> >  builtin/am.c                      |   9 ++\n> >  builtin/rebase.c                  |  30 ++----\n> >  git-legacy-rebase.sh              |  65 ++++++------\n> >  git-rebase--am.sh                 |   2 +-\n> >  git-rebase--common.sh             |   2 +-\n> >  git-rebase--merge.sh              | 164 ------------------------------\n> >  sequencer.c                       |  23 +++--\n> >  sequencer.h                       |   1 +\n> >  t/t3406-rebase-message.sh         |   7 +-\n> >  t/t3420-rebase-autostash.sh       |  78 ++------------\n> >  t/t3421-rebase-topology-linear.sh |  10 +-\n> >  t/t3425-rebase-topology-merges.sh |  15 ++-\n> >  t/t5407-post-rewrite-hook.sh      |  34 +++++++\n> >  t/t9903-bash-prompt.sh            |   2 +-\n> >  17 files changed, 121 insertions(+), 340 deletions(-)\n> >  delete mode 100644 git-rebase--merge.sh\n> > \n> > Range-diff:\n> > -:  ---------- > 1:  2e8b1bcb8b rebase: make builtin and legacy script error messages the same\n> > 1:  2f4bdd1980 ! 2:  eba87828c6 rebase: fix incompatible options error message\n> >     @@ -9,12 +9,12 @@\n> >          understood by separate backends were used:\n> >      \n> >          $ git rebase --keep --ignore-whitespace\n> >     -    fatal: error: cannot combine interactive options (--interactive, --exec,\n> >     +    fatal: cannot combine interactive options (--interactive, --exec,\n> >          --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\n> >          am options (.git/rebase-apply/applying)\n> >      \n> >          $ git rebase --merge --ignore-whitespace\n> >     -    fatal: error: cannot combine merge options (--merge, --strategy,\n> >     +    fatal: cannot combine merge options (--merge, --strategy,\n> >          --strategy-option) with am options (.git/rebase-apply/applying)\n> >      \n> >          Note that in both cases, the list of \"am options\" is\n> >     @@ -33,18 +33,17 @@\n> >       \t\t\t\tbreak;\n> >       \n> >       \t\tif (is_interactive(&options) && i >= 0)\n> >     --\t\t\tdie(_(\"error: cannot combine interactive options \"\n> >     +-\t\t\tdie(_(\"cannot combine interactive options \"\n> >      -\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n> >      -\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n> >      -\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n> >     -+\t\t\tdie(_(\"error: cannot combine am options \"\n> >     ++\t\t\tdie(_(\"cannot combine am options \"\n> >      +\t\t\t      \"with interactive options\"));\n> >       \t\tif (options.type == REBASE_MERGE && i >= 0)\n> >     --\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n> >     +-\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n> >      -\t\t\t      \"--strategy, --strategy-option) with am options \"\n> >      -\t\t\t      \"(%s)\"), buf.buf);\n> >     -+\t\t\tdie(_(\"error: cannot combine am options \"\n> >     -+\t\t\t      \"with merge options \"));\n> >     ++\t\t\tdie(_(\"cannot combine am options with merge options \"));\n> >       \t}\n> >       \n> >       \tif (options.signoff) {\n> >     @@ -56,15 +55,15 @@\n> >       \tthen\n> >       \t\tif test -n \"$incompatible_opts\"\n> >       \t\tthen\n> >     --\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> >     -+\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n> >     +-\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n> >     ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n> >       \t\tfi\n> >       \tfi\n> >       \tif test -n \"$do_merge\"; then\n> >       \t\tif test -n \"$incompatible_opts\"\n> >       \t\tthen\n> >     --\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> >     -+\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n> >     +-\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n> >     ++\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n> >       \t\tfi\n> >       \tfi\n> >       fi\n> > 2:  cc33a8ccc1 = 3:  15d929edb2 t5407: add a test demonstrating how interactive handles --skip differently\n> > 3:  f5838ef763 = 4:  c9d6d5141e am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n> > 4:  50dc863d9f = 5:  0b19ad8e2d git-rebase, sequencer: extend --quiet option for the interactive machinery\n> > 5:  35cf552f27 ! 6:  5ded8654ec git-legacy-rebase: simplify unnecessary triply-nested if\n> >     @@ -18,7 +18,7 @@\n> >          moving the innermost conditional to the outside, allowing us to remove\n> >          the test on git_am_opt entirely and giving us the following form:\n> >      \n> >     -    if incomptable_opts:\n> >     +    if incompatible_opts:\n> >            if interactive:\n> >              show_error_about_interactive_and_am_incompatibilities\n> >            if rebase-merge:\n> >     @@ -44,18 +44,18 @@\n> >       \tthen\n> >      -\t\tif test -n \"$incompatible_opts\"\n> >      -\t\tthen\n> >     --\t\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n> >     +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n> >      -\t\tfi\n> >     -+\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n> >     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n> >       \tfi\n> >      -\tif test -n \"$do_merge\"; then\n> >      -\t\tif test -n \"$incompatible_opts\"\n> >      -\t\tthen\n> >     --\t\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n> >     +-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n> >      -\t\tfi\n> >      +\tif test -n \"$do_merge\"\n> >      +\tthen\n> >     -+\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n> >     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n> >       \tfi\n> >       fi\n> >       \n> > 6:  2a3d8ff1c1 = 7:  bb8e5a4527 rebase: define linearization ordering and enforce it\n> > 7:  58371d377a ! 8:  5de428d695 rebase: Implement --merge via the interactive machinery\n> >     @@ -142,14 +142,15 @@\n> >       \t\timply_interactive(&options, \"--root without --onto\");\n> >       \n> >      @@\n> >     + \t\t\t\tbreak;\n> >       \n> >       \t\tif (is_interactive(&options) && i >= 0)\n> >     - \t\t\tdie(_(\"error: cannot combine am options \"\n> >     +-\t\t\tdie(_(\"cannot combine am options \"\n> >      -\t\t\t      \"with interactive options\"));\n> >      -\t\tif (options.type == REBASE_MERGE && i >= 0)\n> >     --\t\t\tdie(_(\"error: cannot combine am options \"\n> >     --\t\t\t      \"with merge options \"));\n> >     -+\t\t\t      \"with either interactive or merge options\"));\n> >     +-\t\t\tdie(_(\"cannot combine am options with merge options \"));\n> >     ++\t\t\tdie(_(\"cannot combine am options with either \"\n> >     ++\t\t\t      \"interactive or merge options\"));\n> >       \t}\n> >       \n> >       \tif (options.signoff) {\n> >     @@ -205,13 +206,13 @@\n> >       then\n> >      -\tif test -n \"$interactive_rebase\"\n> >      -\tthen\n> >     --\t\tdie \"$(gettext \"error: cannot combine am options with interactive options\")\"\n> >     +-\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n> >      -\tfi\n> >      -\tif test -n \"$do_merge\"\n> >      +\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n> >       \tthen\n> >     --\t\tdie \"$(gettext \"error: cannot combine am options with merge options\")\"\n> >     -+\t\tdie \"$(gettext \"error: cannot combine am options with either interactive or merge options\")\"\n> >     +-\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n> >     ++\t\tdie \"$(gettext \"fatal: cannot combine am options with either interactive or merge options\")\"\n> >       \tfi\n> >       fi\n> >       \n> >     @@ -225,7 +226,7 @@\n> >       \t# linear history?\n> >       \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n> >      @@\n> >     - \tGIT_PAGER='' git diff --stat --summary \"$mb\" \"$onto\"\n> >     + \tGIT_PAGER='' git diff --stat --summary \"$mb_tree\" \"$onto\"\n> >       fi\n> >       \n> >      +if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n> > -- \n> > 2.20.0.8.g5de428d695\n> > \n> > \n> \n"},{"id":"367260","messageId":"nycvar.QRO.7.76.6.1901212201360.41@tvgsbejvaqbjf.bet","threadId":"49781","inReplyTo":"xmqqtvi5irv9.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-01-21T21:02:33Z","receivedAt":"2019-01-21T21:02:58Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Fri, 18 Jan 2019, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Fri, 18 Jan 2019, Junio C Hamano wrote:\n> >\n> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> >> \n> >> > I am about to submit a new iteration of my patch series, would it\n> >> > be too much trouble for you to rebase on top? If it would be, let\n> >> > me know, then I will rebase on top of yours.\n> >> \n> >> Or both of you keep the topics as-is and self-consistent, and let the\n> >> rerere machinery to squash it in when the two topics gets merged.\n> >\n> > With all the experience I have with rerere, I don't trust it.\n> \n> FWIW, I trust it once I got right resolution better than randomly\n> rebased resubmission that needs to be re-reviewed afresh.\n\nOnce again, our experiences teach us diametrically opposed things. I\ndefinitely trust my rebased version more than your rerere-affected\nresolution.\n\nCiao,\nDscho\n"},{"id":"367261","messageId":"CABPp-BEienJstg63Z8a09TQq+-mJf1CUwp4GWeo+odDXzzaK0w@mail.gmail.com","threadId":"49781","inReplyTo":"nycvar.QRO.7.76.6.1901212200400.41@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v4 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-21T21:04:43Z","receivedAt":"2019-01-21T21:04:59Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Dscho,\n\nOn Mon, Jan 21, 2019 at 1:01 PM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Hi Elijah,\n>\n> On Mon, 21 Jan 2019, Johannes Schindelin wrote:\n>\n> > On Tue, 11 Dec 2018, Elijah Newren wrote:\n> >\n> > > Differences since v3 (full range-diff below):\n> > >   - Fixed the redundant \"fatal: error:\" error message prefixes, as pointed\n> > >     out by Duy\n> > >   - Rebased on 2.20.0\n> >\n> >     - Fixed the \"comptable\" tyop\n> >\n> > This, and the range-diff, look reasonable to me.\n>\n> And now that I looked through all 8 patches, those look reasonable to me,\n> too. I think this is ready for `next`.\n>\n> Ciao,\n> Dscho\n\nThanks for reviewing it!\n"},{"id":"367356","messageId":"xmqqy37ce8ad.fsf@gitster-ct.c.googlers.com","threadId":"49781","inReplyTo":"CABPp-BFrgjW-c8NKGYKs1VaH--Oc8yUu0enQMSp1pQVUwBOBwA@mail.gmail.com","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-22T20:39:38Z","receivedAt":"2019-01-22T20:39:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> Also, I have a fuzzy memory of discussing a very similar case with\n> some rebase-oriented option and its on-disk representation, where the\n> concern was more about users upgrading git versions during an\n> incomplete rebase rather than power users looking at internal file\n> contents.  And I think either Phillip or Junio made some statement\n> about considering these internal details and that they felt the worry\n> about upgrade mid-rebase was overly worrying.  But I can't find the\n> emails right now, and it's been so long (at least half a year) that I\n> might be imagining things.\n\nI do recall saying that mid-rebase upgrade is probably not worth\ngetting worried about.\n"},{"id":"367911","messageId":"20190129013945.17336-2-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 1/8] rebase: make builtin and legacy script error messages the same","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:38Z","receivedAt":"2019-01-29T01:39:56Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The conversion of the script version of rebase took messages that were\nprefixed with \"error:\" and passed them along to die(), which adds a\n\"fatal:\" prefix, thus resulting in messages of the form:\n\n  fatal: error: cannot combine...\n\nwhich seems redundant.  Remove the \"error:\" prefix from the builtin\nversion of rebase, and change the prefix from \"error:\" to \"fatal:\" in\nthe legacy script to match.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c     | 10 +++++-----\n git-legacy-rebase.sh | 12 ++++++------\n 2 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex b5c99ec10c..85f980bdce 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1223,12 +1223,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine interactive options \"\n+\t\t\tdie(_(\"cannot combine interactive options \"\n \t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n \t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n \t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n \t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"error: cannot combine merge options (--merge, \"\n+\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n \t\t\t      \"--strategy, --strategy-option) with am options \"\n \t\t\t      \"(%s)\"), buf.buf);\n \t}\n@@ -1248,15 +1248,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t *       git-rebase.txt caveats with \"unless you know what you are doing\"\n \t\t */\n \t\tif (options.rebase_merges)\n-\t\t\tdie(_(\"error: cannot combine '--preserve-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--preserve-merges' with \"\n \t\t\t      \"'--rebase-merges'\"));\n \n \tif (options.rebase_merges) {\n \t\tif (strategy_options.nr)\n-\t\t\tdie(_(\"error: cannot combine '--rebase-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--rebase-merges' with \"\n \t\t\t      \"'--strategy-option'\"));\n \t\tif (options.strategy)\n-\t\t\tdie(_(\"error: cannot combine '--rebase-merges' with \"\n+\t\t\tdie(_(\"cannot combine '--rebase-merges' with \"\n \t\t\t      \"'--strategy'\"));\n \t}\n \ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex b4c7dbfa57..11548e927c 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n \tthen\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n \t\tfi\n \tfi\n \tif test -n \"$do_merge\"; then\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n \t\tfi\n \tfi\n fi\n@@ -522,7 +522,7 @@ fi\n if test -n \"$signoff\"\n then\n \ttest -n \"$preserve_merges\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--signoff' with '--preserve-merges'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--signoff' with '--preserve-merges'\")\"\n \tgit_am_opt=\"$git_am_opt $signoff\"\n \tforce_rebase=t\n fi\n@@ -533,15 +533,15 @@ then\n \t# Note: incompatibility with --interactive is just a strong warning;\n \t#       git-rebase.txt caveats with \"unless you know what you are doing\"\n \ttest -n \"$rebase_merges\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--preserve-merges' with '--rebase-merges'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--preserve-merges' with '--rebase-merges'\")\"\n fi\n \n if test -n \"$rebase_merges\"\n then\n \ttest -n \"$strategy_opts\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--rebase-merges' with '--strategy-option'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--rebase-merges' with '--strategy-option'\")\"\n \ttest -n \"$strategy\" &&\n-\t\tdie \"$(gettext \"error: cannot combine '--rebase-merges' with '--strategy'\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine '--rebase-merges' with '--strategy'\")\"\n fi\n \n if test -z \"$rebase_root\"\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367912","messageId":"20190129013945.17336-7-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 6/8] git-legacy-rebase: simplify unnecessary triply-nested if","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:43Z","receivedAt":"2019-01-29T01:39:57Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The git-legacy-rebase.sh script previously had code of the form:\n\nif git_am_opt:\n  if interactive:\n    if incompatible_opts:\n      show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    if incompatible_opts\n      show_error_about_merge_and_am_incompatibilities\n\nwhich was a triply nested if.  However, the first conditional\n(git_am_opt) and third (incompatible_opts) were somewhat redundant: the\nlatter condition was a strict subset of the former.  Simplify this by\nmoving the innermost conditional to the outside, allowing us to remove\nthe test on git_am_opt entirely and giving us the following form:\n\nif incompatible_opts:\n  if interactive:\n    show_error_about_interactive_and_am_incompatibilities\n  if rebase-merge:\n    show_error_about_merge_and_am_incompatibilities\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-legacy-rebase.sh | 20 ++++++++------------\n 1 file changed, 8 insertions(+), 12 deletions(-)\n\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex f4088b7bda..6baf10192d 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -501,21 +501,17 @@ then\n \tgit_format_patch_opt=\"$git_format_patch_opt --progress\"\n fi\n \n-if test -n \"$git_am_opt\"; then\n-\tincompatible_opts=$(echo \" $git_am_opt \" | \\\n-\t\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+incompatible_opts=$(echo \" $git_am_opt \" | \\\n+\t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n+if test -n \"$incompatible_opts\"\n+then\n \tif test -n \"$interactive_rebase\"\n \tthen\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n-\t\tfi\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n \tfi\n-\tif test -n \"$do_merge\"; then\n-\t\tif test -n \"$incompatible_opts\"\n-\t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n-\t\tfi\n+\tif test -n \"$do_merge\"\n+\tthen\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n \tfi\n fi\n \n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367913","messageId":"20190129013945.17336-5-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 4/8] am, rebase--merge: do not overlook --skip'ed commits with post-rewrite","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:41Z","receivedAt":"2019-01-29T01:39:58Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is supposed to be invoked for each rewritten\ncommit.  The fact that a commit was selected and processed by the rebase\noperation (even though when we hit an error a user said it had no more\nuseful changes), suggests we should write an entry for it.  In\nparticular, let's treat it as an empty commit trivially squashed into\nits parent.\n\nThis brings the rebase--am and rebase--merge backends in sync with the\nbehavior of the interactive rebase backend.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/am.c                 | 9 +++++++++\n git-rebase--merge.sh         | 2 ++\n t/t5407-post-rewrite-hook.sh | 3 +++\n 3 files changed, 14 insertions(+)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 8f27f3375b..af9d034838 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2000,6 +2000,15 @@ static void am_skip(struct am_state *state)\n \tif (clean_index(&head, &head))\n \t\tdie(_(\"failed to clean index\"));\n \n+\tif (state->rebasing) {\n+\t\tFILE *fp = xfopen(am_path(state, \"rewritten\"), \"a\");\n+\n+\t\tassert(!is_null_oid(&state->orig_commit));\n+\t\tfprintf(fp, \"%s \", oid_to_hex(&state->orig_commit));\n+\t\tfprintf(fp, \"%s\\n\", oid_to_hex(&head));\n+\t\tfclose(fp);\n+\t}\n+\n \tam_next(state);\n \tam_load(state);\n \tam_run(state, 0);\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex aa2f2f0872..91250cbaed 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -121,6 +121,8 @@ continue)\n skip)\n \tread_state\n \tgit rerere clear\n+\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n+\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n \tmsgnum=$(($msgnum + 1))\n \twhile test \"$msgnum\" -le \"$end\"\n \tdo\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 6426ec8991..a4a5903cba 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -78,6 +78,7 @@ test_expect_success 'git rebase --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n@@ -91,6 +92,7 @@ test_expect_success 'git rebase --skip the last one' '\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n \t$(git rev-parse E) $(git rev-parse HEAD)\n+\t$(git rev-parse F) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n '\n@@ -120,6 +122,7 @@ test_expect_success 'git rebase -m --skip' '\n \tgit rebase --continue &&\n \techo rebase >expected.args &&\n \tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n \t$(git rev-parse D) $(git rev-parse HEAD)\n \tEOF\n \tverify_hook_input\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367914","messageId":"20190129013945.17336-1-newren@gmail.com","threadId":"49781","inReplyTo":"20181211161139.31686-1-newren@gmail.com","subject":"[PATCH v5 0/8] Reimplement rebase --merge via interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:37Z","receivedAt":"2019-01-29T01:39:59Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"This series continues the work of making rebase more self-consistent\nby removing inconsistencies between different backends.  In\nparticular, this series focuses on making the merge machinery behave\nlike the interactive machinery (though a few differences between the am\nand interactive backends are also fixed along the way), and ultimately\nremoves the merge backend in favor of reimplementing the relevant\noptions on top of the interactive machinery.\n\nDifferences since v4:\n  - Included Dscho's Acked-by (from\n    https://public-inbox.org/git/nycvar.QRO.7.76.6.1901212200400.41@tvgsbejvaqbjf.bet/)\n\nElijah Newren (8):\n  rebase: make builtin and legacy script error messages the same\n  rebase: fix incompatible options error message\n  t5407: add a test demonstrating how interactive handles --skip\n    differently\n  am, rebase--merge: do not overlook --skip'ed commits with post-rewrite\n  git-rebase, sequencer: extend --quiet option for the interactive\n    machinery\n  git-legacy-rebase: simplify unnecessary triply-nested if\n  rebase: define linearization ordering and enforce it\n  rebase: implement --merge via the interactive machinery\n\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +---\n Makefile                          |   1 -\n builtin/am.c                      |   9 ++\n builtin/rebase.c                  |  30 ++----\n git-legacy-rebase.sh              |  65 ++++++------\n git-rebase--am.sh                 |   2 +-\n git-rebase--common.sh             |   2 +-\n git-rebase--merge.sh              | 164 ------------------------------\n sequencer.c                       |  23 +++--\n sequencer.h                       |   1 +\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t3425-rebase-topology-merges.sh |  15 ++-\n t/t5407-post-rewrite-hook.sh      |  34 +++++++\n t/t9903-bash-prompt.sh            |   2 +-\n 17 files changed, 121 insertions(+), 340 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367915","messageId":"20190129013945.17336-9-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 8/8] rebase: implement --merge via the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:45Z","receivedAt":"2019-01-29T01:40:02Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"As part of an ongoing effort to make rebase have more uniform behavior,\nmodify the merge backend to behave like the interactive one, by\nre-implementing it on top of the latter.\n\nInteractive rebases are implemented in terms of cherry-pick rather than\nthe merge-recursive builtin, but cherry-pick also calls into the\nrecursive merge machinery by default and can accept special merge\nstrategies and/or special strategy options.  As such, there really is\nnot any need for having both git-rebase--merge and\ngit-rebase--interactive anymore.  Delete git-rebase--merge.sh and\ninstead implement it in builtin/rebase.c.\n\nThis results in a few deliberate but small user-visible changes:\n  * The progress output is modified (see t3406 and t3420 for examples)\n  * A few known test failures are now fixed (see t3421)\n  * bash-prompt during a rebase --merge is now REBASE-i instead of\n    REBASE-m.  Reason: The prompt is a reflection of the backend in use;\n    this allows users to report an issue to the git mailing list with\n    the appropriate backend information, and allows advanced users to\n    know where to search for relevant control files.  (see t9903)\n\ntestcase modification notes:\n  t3406: --interactive and --merge had slightly different progress output\n         while running; adjust a test to match the new expectation\n  t3420: these test precise output while running, but rebase--am,\n         rebase--merge, and rebase--interactive all were built on very\n         different commands (am, merge-recursive, cherry-pick), so the\n         tests expected different output for each type.  Now we expect\n         --merge and --interactive to have the same output.\n  t3421: --interactive fixes some bugs in --merge!  Wahoo!\n  t9903: --merge uses the interactive backend so the prompt expected is\n         now REBASE-i.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n .gitignore                        |   1 -\n Documentation/git-rebase.txt      |  17 +--\n Makefile                          |   1 -\n builtin/rebase.c                  |  15 ++-\n git-legacy-rebase.sh              |  43 ++++----\n git-rebase--merge.sh              | 166 ------------------------------\n t/t3406-rebase-message.sh         |   7 +-\n t/t3420-rebase-autostash.sh       |  78 ++------------\n t/t3421-rebase-topology-linear.sh |  10 +-\n t/t9903-bash-prompt.sh            |   2 +-\n 10 files changed, 43 insertions(+), 297 deletions(-)\n delete mode 100644 git-rebase--merge.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex 0d77ea5894..910b1d2d2f 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -124,7 +124,6 @@\n /git-rebase--am\n /git-rebase--common\n /git-rebase--interactive\n-/git-rebase--merge\n /git-rebase--preserve-merges\n /git-receive-pack\n /git-reflog\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex dff17b3178..8bfa36a185 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -504,15 +504,7 @@ See also INCOMPATIBLE OPTIONS below.\n INCOMPATIBLE OPTIONS\n --------------------\n \n-git-rebase has many flags that are incompatible with each other,\n-predominantly due to the fact that it has three different underlying\n-implementations:\n-\n- * one based on linkgit:git-am[1] (the default)\n- * one based on git-merge-recursive (merge backend)\n- * one based on linkgit:git-cherry-pick[1] (interactive backend)\n-\n-Flags only understood by the am backend:\n+The following options:\n \n  * --committer-date-is-author-date\n  * --ignore-date\n@@ -520,15 +512,12 @@ Flags only understood by the am backend:\n  * --ignore-whitespace\n  * -C\n \n-Flags understood by both merge and interactive backends:\n+are incompatible with the following options:\n \n  * --merge\n  * --strategy\n  * --strategy-option\n  * --allow-empty-message\n-\n-Flags only understood by the interactive backend:\n-\n  * --[no-]autosquash\n  * --rebase-merges\n  * --preserve-merges\n@@ -539,7 +528,7 @@ Flags only understood by the interactive backend:\n  * --edit-todo\n  * --root when used in combination with --onto\n \n-Other incompatible flag pairs:\n+In addition, the following pairs of options are incompatible:\n \n  * --preserve-merges and --interactive\n  * --preserve-merges and --signoff\ndiff --git a/Makefile b/Makefile\nindex 1a44c811aa..82e1eb1a4a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -628,7 +628,6 @@ SCRIPT_LIB += git-parse-remote\n SCRIPT_LIB += git-rebase--am\n SCRIPT_LIB += git-rebase--common\n SCRIPT_LIB += git-rebase--preserve-merges\n-SCRIPT_LIB += git-rebase--merge\n SCRIPT_LIB += git-sh-setup\n SCRIPT_LIB += git-sh-i18n\n \ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex ec2e5fbf23..d95843a8d4 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -122,7 +122,7 @@ static void imply_interactive(struct rebase_options *opts, const char *option)\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbreak;\n \tcase REBASE_MERGE:\n-\t\t/* we silently *upgrade* --merge to --interactive if needed */\n+\t\t/* we now implement --merge via --interactive */\n \tdefault:\n \t\topts->type = REBASE_INTERACTIVE; /* implied */\n \t\tbreak;\n@@ -481,10 +481,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n \t\tbackend = \"git-rebase--am\";\n \t\tbackend_func = \"git_rebase__am\";\n \t\tbreak;\n-\tcase REBASE_MERGE:\n-\t\tbackend = \"git-rebase--merge\";\n-\t\tbackend_func = \"git_rebase__merge\";\n-\t\tbreak;\n \tcase REBASE_PRESERVE_MERGES:\n \t\tbackend = \"git-rebase--preserve-merges\";\n \t\tbackend_func = \"git_rebase__preserve_merges\";\n@@ -1191,6 +1187,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t}\n \t}\n \n+\tif (options.type == REBASE_MERGE)\n+\t\timply_interactive(&options, \"--merge\");\n+\n \tif (options.root && !options.onto_name)\n \t\timply_interactive(&options, \"--root without --onto\");\n \n@@ -1220,10 +1219,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"cannot combine am options \"\n-\t\t\t      \"with interactive options\"));\n-\t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"cannot combine am options with merge options \"));\n+\t\t\tdie(_(\"cannot combine am options with either \"\n+\t\t\t      \"interactive or merge options\"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 6baf10192d..0c9c19bc60 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -218,6 +218,7 @@ then\n \tstate_dir=\"$apply_dir\"\n elif test -d \"$merge_dir\"\n then\n+\ttype=interactive\n \tif test -d \"$merge_dir\"/rewritten\n \tthen\n \t\ttype=preserve-merges\n@@ -225,10 +226,7 @@ then\n \t\tpreserve_merges=t\n \telif test -f \"$merge_dir\"/interactive\n \tthen\n-\t\ttype=interactive\n \t\tinteractive_rebase=explicit\n-\telse\n-\t\ttype=merge\n \tfi\n \tstate_dir=\"$merge_dir\"\n fi\n@@ -477,6 +475,7 @@ then\n \ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n fi\n \n+actually_interactive=\n if test -n \"$interactive_rebase\"\n then\n \tif test -z \"$preserve_merges\"\n@@ -485,11 +484,12 @@ then\n \telse\n \t\ttype=preserve-merges\n \tfi\n-\n+\tactually_interactive=t\n \tstate_dir=\"$merge_dir\"\n elif test -n \"$do_merge\"\n then\n-\ttype=merge\n+\tinteractive_rebase=implied\n+\ttype=interactive\n \tstate_dir=\"$merge_dir\"\n else\n \ttype=am\n@@ -505,13 +505,9 @@ incompatible_opts=$(echo \" $git_am_opt \" | \\\n \t\t    sed -e 's/ -q / /g' -e 's/^ \\(.*\\) $/\\1/')\n if test -n \"$incompatible_opts\"\n then\n-\tif test -n \"$interactive_rebase\"\n-\tthen\n-\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n-\tfi\n-\tif test -n \"$do_merge\"\n+\tif test -n \"$actually_interactive\" || test \"$do_merge\"\n \tthen\n-\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n+\t\tdie \"$(gettext \"fatal: cannot combine am options with either interactive or merge options\")\"\n \tfi\n fi\n \n@@ -676,7 +672,7 @@ require_clean_work_tree \"rebase\" \"$(gettext \"Please commit or stash them.\")\"\n # but this should be done only when upstream and onto are the same\n # and if this is not an interactive rebase.\n mb=$(git merge-base \"$onto\" \"$orig_head\")\n-if test -z \"$interactive_rebase\" && test \"$upstream\" = \"$onto\" &&\n+if test -z \"$actually_interactive\" && test \"$upstream\" = \"$onto\" &&\n \ttest \"$mb\" = \"$onto\" && test -z \"$restrict_revision\" &&\n \t# linear history?\n \t! (git rev-list --parents \"$onto\"..\"$orig_head\" | sane_grep \" .* \") > /dev/null\n@@ -726,6 +722,19 @@ then\n \tGIT_PAGER='' git diff --stat --summary \"$mb_tree\" \"$onto\"\n fi\n \n+if test -z \"$actually_interactive\" && test \"$mb\" = \"$orig_head\"\n+then\n+\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n+\tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n+\t\tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n+\t# If the $onto is a proper descendant of the tip of the branch, then\n+\t# we just fast-forwarded.\n+\tgit update-ref ORIG_HEAD $orig_head\n+\tmove_to_original_branch\n+\tfinish_rebase\n+\texit 0\n+fi\n+\n test -n \"$interactive_rebase\" && run_specific_rebase\n \n # Detach HEAD and reset the tree\n@@ -735,16 +744,6 @@ GIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\" \\\n \tgit checkout -q \"$onto^0\" || die \"could not detach HEAD\"\n git update-ref ORIG_HEAD $orig_head\n \n-# If the $onto is a proper descendant of the tip of the branch, then\n-# we just fast-forwarded.\n-if test \"$mb\" = \"$orig_head\"\n-then\n-\tsay \"$(eval_gettext \"Fast-forwarded \\$branch_name to \\$onto_name.\")\"\n-\tmove_to_original_branch\n-\tfinish_rebase\n-\texit 0\n-fi\n-\n if test -n \"$rebase_root\"\n then\n \trevisions=\"$onto..$orig_head\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\ndeleted file mode 100644\nindex ced38bb3a6..0000000000\n--- a/git-rebase--merge.sh\n+++ /dev/null\n@@ -1,166 +0,0 @@\n-# This shell script fragment is sourced by git-rebase to implement\n-# its merge-based non-interactive mode that copes well with renamed\n-# files.\n-#\n-# Copyright (c) 2010 Junio C Hamano.\n-#\n-\n-prec=4\n-\n-read_state () {\n-\tonto_name=$(cat \"$state_dir\"/onto_name) &&\n-\tend=$(cat \"$state_dir\"/end) &&\n-\tmsgnum=$(cat \"$state_dir\"/msgnum)\n-}\n-\n-continue_merge () {\n-\ttest -d \"$state_dir\" || die \"$state_dir directory does not exist\"\n-\n-\tunmerged=$(git ls-files -u)\n-\tif test -n \"$unmerged\"\n-\tthen\n-\t\techo \"You still have unmerged paths in your index\"\n-\t\techo \"did you forget to use git add?\"\n-\t\tdie \"$resolvemsg\"\n-\tfi\n-\n-\tcmt=$(cat \"$state_dir/current\")\n-\tif ! git diff-index --quiet --ignore-submodules HEAD --\n-\tthen\n-\t\tif ! git commit ${gpg_sign_opt:+\"$gpg_sign_opt\"} $signoff $allow_empty_message \\\n-\t\t\t--no-verify -C \"$cmt\"\n-\t\tthen\n-\t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n-\t\t\techo \"directly, but instead do one of the following: \"\n-\t\t\tdie \"$resolvemsg\"\n-\t\tfi\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Committed: %0${prec}d \" $msgnum\n-\t\tfi\n-\t\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\telse\n-\t\tif test -z \"$GIT_QUIET\"\n-\t\tthen\n-\t\t\tprintf \"Already applied: %0${prec}d \" $msgnum\n-\t\tfi\n-\tfi\n-\ttest -z \"$GIT_QUIET\" &&\n-\tGIT_PAGER='' git log --format=%s -1 \"$cmt\"\n-\n-\t# onto the next patch:\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-}\n-\n-call_merge () {\n-\tmsgnum=\"$1\"\n-\techo \"$msgnum\" >\"$state_dir/msgnum\"\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt\" > \"$state_dir/current\"\n-\tgit update-ref REBASE_HEAD \"$cmt\"\n-\thd=$(git rev-parse --verify HEAD)\n-\tcmt_name=$(git symbolic-ref HEAD 2> /dev/null || echo HEAD)\n-\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n-\teval GITHEAD_$hd='$onto_name'\n-\texport GITHEAD_$cmt GITHEAD_$hd\n-\tif test -n \"$GIT_QUIET\"\n-\tthen\n-\t\tGIT_MERGE_VERBOSITY=1 && export GIT_MERGE_VERBOSITY\n-\tfi\n-\ttest -z \"$strategy\" && strategy=recursive\n-\t# If cmt doesn't have a parent, don't include it as a base\n-\tbase=$(git rev-parse --verify --quiet $cmt^)\n-\teval 'git merge-$strategy' $strategy_opts $base ' -- \"$hd\" \"$cmt\"'\n-\trv=$?\n-\tcase \"$rv\" in\n-\t0)\n-\t\tunset GITHEAD_$cmt GITHEAD_$hd\n-\t\treturn\n-\t\t;;\n-\t1)\n-\t\tgit rerere $allow_rerere_autoupdate\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t2)\n-\t\techo \"Strategy: $strategy failed, try another\" 1>&2\n-\t\tdie \"$resolvemsg\"\n-\t\t;;\n-\t*)\n-\t\tdie \"Unknown exit code ($rv) from command:\" \\\n-\t\t\t\"git merge-$strategy $cmt^ -- HEAD $cmt\"\n-\t\t;;\n-\tesac\n-}\n-\n-finish_rb_merge () {\n-\tmove_to_original_branch\n-\tif test -s \"$state_dir\"/rewritten\n-\tthen\n-\t\tgit notes copy --for-rewrite=rebase <\"$state_dir\"/rewritten\n-\t\thook=\"$(git rev-parse --git-path hooks/post-rewrite)\"\n-\t\ttest -x \"$hook\" && \"$hook\" rebase <\"$state_dir\"/rewritten\n-\tfi\n-\tsay All done.\n-}\n-\n-git_rebase__merge () {\n-\n-case \"$action\" in\n-continue)\n-\tread_state\n-\tcontinue_merge\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-skip)\n-\tread_state\n-\tgit rerere clear\n-\tcmt=\"$(cat \"$state_dir/cmt.$msgnum\")\"\n-\techo \"$cmt $(git rev-parse HEAD^0)\" >> \"$state_dir/rewritten\"\n-\tmsgnum=$(($msgnum + 1))\n-\twhile test \"$msgnum\" -le \"$end\"\n-\tdo\n-\t\tcall_merge \"$msgnum\"\n-\t\tcontinue_merge\n-\tdone\n-\tfinish_rb_merge\n-\treturn\n-\t;;\n-show-current-patch)\n-\texec git show REBASE_HEAD --\n-\t;;\n-esac\n-\n-mkdir -p \"$state_dir\"\n-echo \"$onto_name\" > \"$state_dir/onto_name\"\n-write_basic_state\n-rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n-\n-msgnum=0\n-for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n-do\n-\tmsgnum=$(($msgnum + 1))\n-\techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\n-done\n-\n-echo 1 >\"$state_dir/msgnum\"\n-echo $msgnum >\"$state_dir/end\"\n-\n-end=$msgnum\n-msgnum=1\n-\n-while test \"$msgnum\" -le \"$end\"\n-do\n-\tcall_merge \"$msgnum\"\n-\tcontinue_merge\n-done\n-\n-finish_rb_merge\n-\n-}\ndiff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh\nindex f64b130cb8..b393e1e9fe 100755\n--- a/t/t3406-rebase-message.sh\n+++ b/t/t3406-rebase-message.sh\n@@ -17,14 +17,9 @@ test_expect_success 'setup' '\n \tgit tag start\n '\n \n-cat >expect <<\\EOF\n-Already applied: 0001 A\n-Already applied: 0002 B\n-Committed: 0003 Z\n-EOF\n-\n test_expect_success 'rebase -m' '\n \tgit rebase -m master >report &&\n+\t>expect &&\n \tsed -n -e \"/^Already applied: /p\" \\\n \t\t-e \"/^Committed: /p\" report >actual &&\n \ttest_cmp expect actual\ndiff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh\nindex 4c7494cc8f..2d1094e483 100755\n--- a/t/t3420-rebase-autostash.sh\n+++ b/t/t3420-rebase-autostash.sh\n@@ -53,41 +53,6 @@ create_expected_success_interactive () {\n \tEOF\n }\n \n-create_expected_success_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplied autostash.\n-\tEOF\n-}\n-\n create_expected_failure_am () {\n \tcat >expected <<-EOF\n \t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n@@ -112,43 +77,6 @@ create_expected_failure_interactive () {\n \tEOF\n }\n \n-create_expected_failure_merge () {\n-\tcat >expected <<-EOF\n-\t$(grep \"^Created autostash: [0-9a-f][0-9a-f]*\\$\" actual)\n-\tHEAD is now at $(git rev-parse --short feature-branch) third commit\n-\tFirst, rewinding head to replay your work on top of it...\n-\tMerging unrelated-onto-branch with HEAD~1\n-\tMerging:\n-\t$(git rev-parse --short unrelated-onto-branch) unrelated commit\n-\t$(git rev-parse --short feature-branch^) second commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~2) initial commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch~1)] second commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:14:13 2005 -0700\n-\t 2 files changed, 2 insertions(+)\n-\t create mode 100644 file1\n-\t create mode 100644 file2\n-\tCommitted: 0001 second commit\n-\tMerging unrelated-onto-branch with HEAD~0\n-\tMerging:\n-\t$(git rev-parse --short rebased-feature-branch~1) second commit\n-\t$(git rev-parse --short feature-branch) third commit\n-\tfound 1 common ancestor:\n-\t$(git rev-parse --short feature-branch~1) second commit\n-\t[detached HEAD $(git rev-parse --short rebased-feature-branch)] third commit\n-\t Author: A U Thor <author@example.com>\n-\t Date: Thu Apr 7 15:15:13 2005 -0700\n-\t 1 file changed, 1 insertion(+)\n-\t create mode 100644 file3\n-\tCommitted: 0002 third commit\n-\tAll done.\n-\tApplying autostash resulted in conflicts.\n-\tYour changes are safe in the stash.\n-\tYou can run \"git stash pop\" or \"git stash drop\" at any time.\n-\tEOF\n-}\n-\n testrebase () {\n \ttype=$1\n \tdotest=$2\n@@ -177,6 +105,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type --autostash: check output\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_success_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\n@@ -274,6 +205,9 @@ testrebase () {\n \ttest_expect_success \"rebase$type: check output with conflicting stash\" '\n \t\ttest_when_finished git branch -D rebased-feature-branch &&\n \t\tsuffix=${type#\\ --} && suffix=${suffix:-am} &&\n+\t\tif test ${suffix} = \"merge\"; then\n+\t\t\tsuffix=interactive\n+\t\tfi &&\n \t\tcreate_expected_failure_$suffix &&\n \t\ttest_i18ncmp expected actual\n \t'\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex 23ad4cff35..7274dca40b 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -111,7 +111,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -126,7 +126,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -141,7 +141,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -284,7 +284,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase success -p\n \n@@ -315,7 +315,7 @@ test_run_rebase () {\n \t\"\n }\n test_run_rebase success ''\n-test_run_rebase failure -m\n+test_run_rebase success -m\n test_run_rebase success -i\n test_have_prereq !REBASE_P || test_run_rebase failure -p\n \ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 81a5179e28..5cadedb2a9 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -180,7 +180,7 @@ test_expect_success 'prompt - interactive rebase' '\n '\n \n test_expect_success 'prompt - rebase merge' '\n-\tprintf \" (b2|REBASE-m 1/3)\" >expected &&\n+\tprintf \" (b2|REBASE-i 1/3)\" >expected &&\n \tgit checkout b2 &&\n \ttest_when_finished \"git checkout master\" &&\n \ttest_must_fail git rebase --merge b1 b2 &&\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367916","messageId":"20190129013945.17336-6-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:42Z","receivedAt":"2019-01-29T01:40:03Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"While 'quiet' and 'interactive' may sound like antonyms, the interactive\nmachinery actually has logic that implements several\ninteractive_rebase=implied cases (--exec, --keep-empty, --rebase-merges)\nwhich won't pop up an editor.  The rewrite of interactive rebase in C\nadded a quiet option, though it only turns stats off.  Since we want to\nmake the interactive machinery also take over for git-rebase--merge, it\nshould fully implement the --quiet option.\n\ngit-rebase--interactive was already somewhat quieter than\ngit-rebase--merge and git-rebase--am, possibly because cherry-pick has\njust traditionally been quieter.  As such, we only drop a few\ninformational messages -- \"Rebasing (n/m)\" and \"Successfully rebased...\"\n\nAlso, for simplicity, remove the differences in how quiet and verbose\noptions were recorded.  Having one be signalled by the presence of a\n\"verbose\" file in the state_dir, while the other was signalled by the\ncontents of a \"quiet\" file was just weirdly inconsistent.  (This\ninconsistency pre-dated the rewrite into C.)  Make them consistent by\nhaving them both key off the presence of the file.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c      |  5 +----\n git-legacy-rebase.sh  |  2 +-\n git-rebase--common.sh |  2 +-\n sequencer.c           | 23 +++++++++++++----------\n sequencer.h           |  1 +\n 5 files changed, 17 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 78e982298f..ec2e5fbf23 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)\n \tif (get_oid(buf.buf, &opts->orig_head))\n \t\treturn error(_(\"invalid orig-head: '%s'\"), buf.buf);\n \n-\tstrbuf_reset(&buf);\n-\tif (read_one(state_dir_path(\"quiet\", opts), &buf))\n-\t\treturn -1;\n-\tif (buf.len)\n+\tif (file_exists(state_dir_path(\"quiet\", opts)))\n \t\topts->flags &= ~REBASE_NO_QUIET;\n \telse\n \t\topts->flags |= REBASE_NO_QUIET;\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex fccb33b959..f4088b7bda 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -113,7 +113,7 @@ read_basic_state () {\n \telse\n \t\torig_head=$(cat \"$state_dir\"/head)\n \tfi &&\n-\tGIT_QUIET=$(cat \"$state_dir\"/quiet) &&\n+\ttest -f \"$state_dir\"/quiet && GIT_QUIET=t\n \ttest -f \"$state_dir\"/verbose && verbose=t\n \ttest -f \"$state_dir\"/strategy && strategy=\"$(cat \"$state_dir\"/strategy)\"\n \ttest -f \"$state_dir\"/strategy_opts &&\ndiff --git a/git-rebase--common.sh b/git-rebase--common.sh\nindex 7e39d22871..dc18c682fa 100644\n--- a/git-rebase--common.sh\n+++ b/git-rebase--common.sh\n@@ -10,7 +10,7 @@ write_basic_state () {\n \techo \"$head_name\" > \"$state_dir\"/head-name &&\n \techo \"$onto\" > \"$state_dir\"/onto &&\n \techo \"$orig_head\" > \"$state_dir\"/orig-head &&\n-\techo \"$GIT_QUIET\" > \"$state_dir\"/quiet &&\n+\ttest t = \"$GIT_QUIET\" && : > \"$state_dir\"/quiet\n \ttest t = \"$verbose\" && : > \"$state_dir\"/verbose\n \ttest -n \"$strategy\" && echo \"$strategy\" > \"$state_dir\"/strategy\n \ttest -n \"$strategy_opts\" && echo \"$strategy_opts\" > \\\ndiff --git a/sequencer.c b/sequencer.c\nindex e1a4dd15f1..bc25615050 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -150,6 +150,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, \"rebase-merge/refs-to-delete\")\n static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, \"rebase-merge/gpg_sign_opt\")\n static GIT_PATH_FUNC(rebase_path_orig_head, \"rebase-merge/orig-head\")\n static GIT_PATH_FUNC(rebase_path_verbose, \"rebase-merge/verbose\")\n+static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n static GIT_PATH_FUNC(rebase_path_signoff, \"rebase-merge/signoff\")\n static GIT_PATH_FUNC(rebase_path_head_name, \"rebase-merge/head-name\")\n static GIT_PATH_FUNC(rebase_path_onto, \"rebase-merge/onto\")\n@@ -157,7 +158,6 @@ 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-static GIT_PATH_FUNC(rebase_path_quiet, \"rebase-merge/quiet\")\n \n static int git_sequencer_config(const char *k, const char *v, void *cb)\n {\n@@ -2357,6 +2357,9 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\tif (file_exists(rebase_path_verbose()))\n \t\t\topts->verbose = 1;\n \n+\t\tif (file_exists(rebase_path_quiet()))\n+\t\t\topts->quiet = 1;\n+\n \t\tif (file_exists(rebase_path_signoff())) {\n \t\t\topts->allow_ff = 0;\n \t\t\topts->signoff = 1;\n@@ -2424,9 +2427,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n \n \tif (quiet)\n \t\twrite_file(rebase_path_quiet(), \"%s\\n\", quiet);\n-\telse\n-\t\twrite_file(rebase_path_quiet(), \"\\n\");\n-\n \tif (opts->verbose)\n \t\twrite_file(rebase_path_verbose(), \"%s\", \"\");\n \tif (opts->strategy)\n@@ -3503,10 +3503,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t\t\t\tfprintf(f, \"%d\\n\", todo_list->done_nr);\n \t\t\t\t\tfclose(f);\n \t\t\t\t}\n-\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n-\t\t\t\t\ttodo_list->done_nr,\n-\t\t\t\t\ttodo_list->total_nr,\n-\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n+\t\t\t\tif (!opts->quiet)\n+\t\t\t\t\tfprintf(stderr, \"Rebasing (%d/%d)%s\",\n+\t\t\t\t\t\ttodo_list->done_nr,\n+\t\t\t\t\t\ttodo_list->total_nr,\n+\t\t\t\t\t\topts->verbose ? \"\\n\" : \"\\r\");\n \t\t\t}\n \t\t\tunlink(rebase_path_message());\n \t\t\tunlink(rebase_path_author_script());\n@@ -3738,8 +3739,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)\n \t\t}\n \t\tapply_autostash(opts);\n \n-\t\tfprintf(stderr, \"Successfully rebased and updated %s.\\n\",\n-\t\t\thead_ref.buf);\n+\t\tif (!opts->quiet)\n+\t\t\tfprintf(stderr,\n+\t\t\t\t\"Successfully rebased and updated %s.\\n\",\n+\t\t\t\thead_ref.buf);\n \n \t\tstrbuf_release(&buf);\n \t\tstrbuf_release(&head_ref);\ndiff --git a/sequencer.h b/sequencer.h\nindex 5071a73563..729222b583 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -39,6 +39,7 @@ struct replay_opts {\n \tint allow_empty_message;\n \tint keep_redundant_commits;\n \tint verbose;\n+\tint quiet;\n \n \tint mainline;\n \n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367917","messageId":"20190129013945.17336-8-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 7/8] rebase: define linearization ordering and enforce it","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:44Z","receivedAt":"2019-01-29T01:40:04Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Ever since commit 3f213981e44a (\"add tests for rebasing merged history\",\n2013-06-06), t3425 has had tests which included the rebasing of merged\nhistory and whose order of applied commits was checked.  Unfortunately,\nthe tests expected different behavior depending on which backend was in\nuse.  Implementing these checks was the following four lines (including\nthe TODO message) which were repeated verbatim three times in t3425:\n\n    #TODO: make order consistent across all flavors of rebase\n    test_run_rebase success 'e n o' ''\n    test_run_rebase success 'e n o' -m\n    test_run_rebase success 'n o e' -i\n\nAs part of the effort to reduce differences between the rebase backends\nso that users get more uniform behavior, let's define the correct\nbehavior and modify the different backends so they all get the right\nanswer.  It turns out that the difference in behavior here is entirely\ndue to topological sorting; since some backends require topological\nsorting (particularly when --rebase-merges is specified), require it for\nall modes.  Modify the am and merge backends to implement this.\n\nPerformance Considerations:\n\nI was unable to measure any appreciable performance difference with this\nchange.  Trying to control the run-to-run variation was difficult; I\neventually found a headless beefy box that I could ssh into, which\nseemed to help.  Using git.git, I ran the following testcase:\n    $ git reset --hard v2.20.0-rc1~2\n    $ time git rebase --quiet v2.20.0-rc0~16\n\nI first ran once to warm any disk caches, then ran five subsequent runs\nand recorded the times of those five.  I observed the following results\nfor the average time:\n\n     Before this change:\n       \"real\" timing: 1.340s (standard deviation: 0.040s)\n       \"user\" timing: 1.050s (standard deviation: 0.041s)\n       \"sys\"  timing: 0.270s (standard deviation: 0.011s)\n     After  this change:\n       \"real\" timing: 1.327s (standard deviation: 0.065s)\n       \"user\" timing: 1.031s (standard deviation: 0.061s)\n       \"sys\"  timing: 0.280s (standard deviation: 0.014s)\n\nMeasurements aside, I would expect the timing for walking revisions to\nbe dwarfed by the work involved in creating and applying patches, so\nthis isn't too surprising.  Further, while somewhat counter-intuitive,\nit is possible that turning on topological sorting is actually a\nperformance improvement: by way of comparison, turning on --topo-order\nmade fast-export faster (see\nhttps://public-inbox.org/git/20090211135640.GA19600@coredump.intra.peff.net/).\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n git-rebase--am.sh                 |  2 +-\n git-rebase--merge.sh              |  2 +-\n t/t3425-rebase-topology-merges.sh | 15 ++++++---------\n 3 files changed, 8 insertions(+), 11 deletions(-)\n\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 99b8c17787..6416716ee6 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -36,7 +36,7 @@ rm -f \"$GIT_DIR/rebased-patches\"\n \n git format-patch -k --stdout --full-index --cherry-pick --right-only \\\n \t--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \\\n-\t--pretty=mboxrd \\\n+\t--pretty=mboxrd --topo-order \\\n \t$git_format_patch_opt \\\n \t\"$revisions\" ${restrict_revision+^$restrict_revision} \\\n \t>\"$GIT_DIR/rebased-patches\"\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex 91250cbaed..ced38bb3a6 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -143,7 +143,7 @@ write_basic_state\n rm -f \"$(git rev-parse --git-path REBASE_HEAD)\"\n \n msgnum=0\n-for cmt in $(git rev-list --reverse --no-merges \"$revisions\")\n+for cmt in $(git rev-list --topo-order --reverse --no-merges \"$revisions\")\n do\n \tmsgnum=$(($msgnum + 1))\n \techo \"$cmt\" > \"$state_dir/cmt.$msgnum\"\ndiff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh\nindex 5f892e33d7..fd8efe84fe 100755\n--- a/t/t3425-rebase-topology-merges.sh\n+++ b/t/t3425-rebase-topology-merges.sh\n@@ -70,9 +70,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" d..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'e n o' ''\n-test_run_rebase success 'e n o' -m\n+test_run_rebase success 'n o e' ''\n+test_run_rebase success 'n o e' -m\n test_run_rebase success 'n o e' -i\n \n test_run_rebase () {\n@@ -87,9 +86,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n test_run_rebase () {\n@@ -104,9 +102,8 @@ test_run_rebase () {\n \t\ttest_linear_range \"\\'\"$expected\"\\'\" c..\n \t\"\n }\n-#TODO: make order consistent across all flavors of rebase\n-test_run_rebase success 'd e n o' ''\n-test_run_rebase success 'd e n o' -m\n+test_run_rebase success 'd n o e' ''\n+test_run_rebase success 'd n o e' -m\n test_run_rebase success 'd n o e' -i\n \n if ! test_have_prereq REBASE_P; then\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367918","messageId":"20190129013945.17336-3-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 2/8] rebase: fix incompatible options error message","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:39Z","receivedAt":"2019-01-29T01:40:05Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"In commit f57696802c30 (\"rebase: really just passthru the `git am`\noptions\", 2018-11-14), the handling of `git am` options was simplified\ndramatically (and an option parsing bug was fixed), but it introduced\na small regression in the error message shown when options only\nunderstood by separate backends were used:\n\n$ git rebase --keep --ignore-whitespace\nfatal: cannot combine interactive options (--interactive, --exec,\n--rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with\nam options (.git/rebase-apply/applying)\n\n$ git rebase --merge --ignore-whitespace\nfatal: cannot combine merge options (--merge, --strategy,\n--strategy-option) with am options (.git/rebase-apply/applying)\n\nNote that in both cases, the list of \"am options\" is\n\".git/rebase-apply/applying\", which makes no sense.  Since the lists of\nbackend-specific options is documented pretty thoroughly in the rebase\nman page (in the \"Incompatible Options\" section, with multiple links\nthroughout the document), and since I expect this list to change over\ntime, just simplify the error message.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n builtin/rebase.c     | 10 +++-------\n git-legacy-rebase.sh |  4 ++--\n 2 files changed, 5 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 85f980bdce..78e982298f 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -1223,14 +1223,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)\n \t\t\t\tbreak;\n \n \t\tif (is_interactive(&options) && i >= 0)\n-\t\t\tdie(_(\"cannot combine interactive options \"\n-\t\t\t      \"(--interactive, --exec, --rebase-merges, \"\n-\t\t\t      \"--preserve-merges, --keep-empty, --root + \"\n-\t\t\t      \"--onto) with am options (%s)\"), buf.buf);\n+\t\t\tdie(_(\"cannot combine am options \"\n+\t\t\t      \"with interactive options\"));\n \t\tif (options.type == REBASE_MERGE && i >= 0)\n-\t\t\tdie(_(\"cannot combine merge options (--merge, \"\n-\t\t\t      \"--strategy, --strategy-option) with am options \"\n-\t\t\t      \"(%s)\"), buf.buf);\n+\t\t\tdie(_(\"cannot combine am options with merge options \"));\n \t}\n \n \tif (options.signoff) {\ndiff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh\nindex 11548e927c..fccb33b959 100755\n--- a/git-legacy-rebase.sh\n+++ b/git-legacy-rebase.sh\n@@ -508,13 +508,13 @@ if test -n \"$git_am_opt\"; then\n \tthen\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine am options with interactive options\")\"\n \t\tfi\n \tfi\n \tif test -n \"$do_merge\"; then\n \t\tif test -n \"$incompatible_opts\"\n \t\tthen\n-\t\t\tdie \"$(gettext \"fatal: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts)\")\"\n+\t\t\tdie \"$(gettext \"fatal: cannot combine am options with merge options\")\"\n \t\tfi\n \tfi\n fi\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"367919","messageId":"20190129013945.17336-4-newren@gmail.com","threadId":"49781","inReplyTo":"20190129013945.17336-1-newren@gmail.com","subject":"[PATCH v5 3/8] t5407: add a test demonstrating how interactive handles --skip differently","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-01-29T01:39:40Z","receivedAt":"2019-01-29T01:40:08Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"The post-rewrite hook is documented as being invoked by commands that\nrewrite commits such as commit --amend and rebase, and that it will\nbe called for each rewritten commit.\n\nApparently, the three backends handled --skip'ed commits differently:\n  am: treat the skipped commit as though it weren't rewritten\n  merge: same as 'am' backend\n  interactive: treat skipped commits as having been rewritten to empty\n     (view them as an empty fixup to their parent)\n\nFor now, just add a testcase documenting the different behavior (use\n--keep to force usage of the interactive machinery even though we have\nno empty commits).  A subsequent commit will remove the inconsistency in\n--skip handling.\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n t/t5407-post-rewrite-hook.sh | 31 +++++++++++++++++++++++++++++++\n 1 file changed, 31 insertions(+)\n\ndiff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh\nindex 9b2a274c71..6426ec8991 100755\n--- a/t/t5407-post-rewrite-hook.sh\n+++ b/t/t5407-post-rewrite-hook.sh\n@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '\n \tverify_hook_input\n '\n \n+test_expect_success 'git rebase with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\techo C > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n+test_expect_success 'git rebase --skip with implicit use of interactive backend' '\n+\tgit reset --hard D &&\n+\tclear_hook_input &&\n+\ttest_must_fail git rebase --keep --onto A B &&\n+\ttest_must_fail git rebase --skip &&\n+\techo D > foo &&\n+\tgit add foo &&\n+\tgit rebase --continue &&\n+\techo rebase >expected.args &&\n+\tcat >expected.data <<-EOF &&\n+\t$(git rev-parse C) $(git rev-parse HEAD^)\n+\t$(git rev-parse D) $(git rev-parse HEAD)\n+\tEOF\n+\tverify_hook_input\n+'\n+\n . \"$TEST_DIRECTORY\"/lib-rebase.sh\n \n set_fake_editor\n-- \n2.20.1.310.g17ca096f17\n\n"},{"id":"369701","messageId":"63822309-1c58-a4a2-fa2b-d694bd9b8663@talktalk.net","threadId":"49781","inReplyTo":"xmqqy37ce8ad.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2019-02-20T11:00:38Z","receivedAt":"2019-02-20T11:00:38Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 22/01/2019 20:39, Junio C Hamano wrote:\n> Elijah Newren <newren@gmail.com> writes:\n> \n>> Also, I have a fuzzy memory of discussing a very similar case with\n>> some rebase-oriented option and its on-disk representation, where the\n>> concern was more about users upgrading git versions during an\n>> incomplete rebase rather than power users looking at internal file\n>> contents.  And I think either Phillip or Junio made some statement\n>> about considering these internal details and that they felt the worry\n>> about upgrade mid-rebase was overly worrying.  But I can't find the\n>> emails right now, and it's been so long (at least half a year) that I\n>> might be imagining things.\n> \n> I do recall saying that mid-rebase upgrade is probably not worth\n> getting worried about.\n> \n\nIn light of yesterday's bug report [1] about those other changes I'm\nmore concerned about this change. We were worrying about whether or not\nto worry about a mid-rebase upgrade but it seems people can have two\ndifferent versions of git installed - one bundled with something like\ntig and another they use on the command line. If they start a rebase\nwith a version containing this patch and try to continue it with a\nversion that does not then the older version will fail with a complaint\nabout a missing quiet file. The other way round they'll potentially get\nthe wrong quiet setting which isn't such a problem. It's probably a bit\nlate in the release cycle now to change this? But we could flag it up in\nthe release notes and bear it in mind when making changes in the future.\n\nBest Wishes\n\nPhillip\n\n\n[1]\nhttps://public-inbox.org/git/d7acf780-522d-84e6-68b8-d8d35a305588@talktalk.net/T/#maa521f788bd61f9b65d52c14430a88bf077e6752\n"},{"id":"369827","messageId":"CABPp-BENWQGSCj5F1FWm5s8vD6aYexJNbpGY8MGjs4AmZOnnYg@mail.gmail.com","threadId":"49781","inReplyTo":"63822309-1c58-a4a2-fa2b-d694bd9b8663@talktalk.net","subject":"Re: [PATCH v4 5/8] git-rebase, sequencer: extend --quiet option for the interactive machinery","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-02-21T17:44:37Z","receivedAt":"2019-02-21T17:44:54Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi Phillip,\n\nOn Wed, Feb 20, 2019 at 3:00 AM Phillip Wood <phillip.wood@talktalk.net> wrote:\n> On 22/01/2019 20:39, Junio C Hamano wrote:\n> > Elijah Newren <newren@gmail.com> writes:\n> >\n> >> Also, I have a fuzzy memory of discussing a very similar case with\n> >> some rebase-oriented option and its on-disk representation, where the\n> >> concern was more about users upgrading git versions during an\n> >> incomplete rebase rather than power users looking at internal file\n> >> contents.  And I think either Phillip or Junio made some statement\n> >> about considering these internal details and that they felt the worry\n> >> about upgrade mid-rebase was overly worrying.  But I can't find the\n> >> emails right now, and it's been so long (at least half a year) that I\n> >> might be imagining things.\n> >\n> > I do recall saying that mid-rebase upgrade is probably not worth\n> > getting worried about.\n> >\n>\n> In light of yesterday's bug report [1] about those other changes I'm\n> more concerned about this change. We were worrying about whether or not\n> to worry about a mid-rebase upgrade but it seems people can have two\n> different versions of git installed - one bundled with something like\n> tig and another they use on the command line. If they start a rebase\n> with a version containing this patch and try to continue it with a\n> version that does not then the older version will fail with a complaint\n> about a missing quiet file. The other way round they'll potentially get\n> the wrong quiet setting which isn't such a problem. It's probably a bit\n> late in the release cycle now to change this? But we could flag it up in\n> the release notes and bear it in mind when making changes in the future.\n\nThanks for the heads up; I'll try to keep it in mind for the future.\n"}]}