{"thread":{"id":"36565","subject":"[PATCH v6 0/7] Reject non-ff pulls by default","startedAt":"2014-05-02T00:00:01Z","lastAt":"2014-05-02T23:51:57Z","messageCount":18,"participants":["Felipe Contreras","brian m. carlson","W. Trevor King","Richard Hansen"],"isPatch":true,"patchVersion":6,"patchTotal":7},"messages":[{"id":"240492","messageId":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":null,"subject":"[PATCH v6 0/7] Reject non-ff pulls by default","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:01Z","receivedAt":"2014-05-02T00:00:01Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"NOTE: Added a commit to throw a warning before the final switch.\n\nIt is very typical for Git newcomers to inadvertently create merges and worst:\ninadvertently pushing them. This is one of the reasons many experienced users\nprefer to avoid 'git pull', and recommend newcomers to avoid it as well.\n\nTo avoid these problems and keep 'git pull' useful, it has been agreed that\n'git pull' should barf by default if the merge is non-fast-forward.\nUnfortunately this breaks backwards-compatibility, so we need to be careful\nabout the error messages we give, and that we provide enough information to our\nusers to move forward without distrupting their workflow too much.\n\nWith the proper error messages and documentation, it has been agreed that the\nnew behavior is OK.\n\nThese are the steps needed to achieve this:\n\n4) Only allow fast-forward merges by default\n\nWe could pass --ff-only to `git merge`, however, if we do that we'll get an error like this:\n\n  Not possible to fast-forward, aborting.\n\nThis is not friendly; we want an error that is user-friendly:\n\n  The pull was not fast-forward, please either merge or rebase.\n  If unsure, run 'git pull --merge'.\n\nWhen we do this we want to give the users the option to go back to the previous\nbehavior, so a new configuration is needed.\n\n3) Add ff-only config\n\nThis option would trigger a check inside `git pull` itself, and error out with\nthe aforementioned message if it's not possible to do a fast-forward merge.\n\nHowever, this option conflicts with --rebase, and --no-rebase. Solution below.\n\n2) Add --merge option\n\nSince we have a message that says \"If unsure, run 'git pull --merge'\", which is\nmore friendly than 'git pull --no-rebase', we should add this option, and\ndeprecate --no-rebase.\n\nHowever, the documentation would become confusing if --merge is configured in\npull.rebase, instead, we want something like this:\n\n  See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want\n  to make `git pull` always use `--merge`.\n\n1) Rename pull.rename to pull.mode and\n   branch.<name>.rebase to branch.<name>.pullmode\n\nThis way the configurations and options remain consistent:\n\n  git pull --merge\n  pull.mode = merge\n  branch.<name>.pullmode = merge\n\n  git pull --rebase\n  pull.mode = rebase\n  branch.<name>.pullmode = rebase\n\n  git pull --rebase=preserve\n  pull.mode = rebase-preserve\n  branch.<name>.pullmode = rebase-preserve\n\n  git pull\n  pull.mode = ff-only\n  branch.<name>.pullmode = ff-only\n \nThis patch series does all the steps mentioned, but in reverse order, and in\naddition updates the tests to use the new configurations instead.\n\nChanges since v5:\n\n * Add commit to enable a transitional warning\n * Renamed option to ff-only\n * Added deprecation documentation for configs\n * Removed config deprecation warnings\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 4ebd3b5..b391ec1 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -774,6 +774,8 @@ branch.<name>.pullmode::\n \t'git rebase' so that locally committed merge commits will not be\n \tflattened by running 'git pull'.\n +\n+\tIt was named 'branch.<name>.rebase' but that is deprecated now.\n++\n *NOTE*: this is a possibly dangerous operation; do *not* use\n it unless you understand the implications (see linkgit:git-rebase[1]\n for details).\n@@ -1884,8 +1886,8 @@ pretty.<name>::\n pull.mode::\n \tWhen \"git pull\" is run, this determines if it would either merge or\n \trebase the fetched branch. The possible values are 'merge',\n-\t'rebase', 'merge-ff-only,' and 'rebase-preserve'.\n-\tIf 'merge-ff-only' is specified, the merge will only succeed if it's\n+\t'rebase', 'ff-only,' and 'rebase-preserve'.\n+\tIf 'ff-only' is specified, the merge will only succeed if it's\n \tfast-forward.\n \tSee \"branch.<name>.pullmode\" for doing this in a non branch-specific\n \tmanner.\n@@ -1894,6 +1896,9 @@ pull.mode::\n \t'git rebase' so that locally committed merge commits will not be\n \tflattened by running 'git pull'.\n +\n++\n+\tIt was named 'pull.rebase' but that is deprecated now.\n++\n *NOTE*: this is a possibly dangerous operation; do *not* use\n it unless you understand the implications (see linkgit:git-rebase[1]\n for details).\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex ca8e951..968315c 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -54,7 +54,7 @@ Then `git pull` will merge in a fast-foward way up to the new master.\n However, a non-fast-foward case looks very different.\n \n ------------\n-\t  A---B---C origin/master\n+\t  A---B---C master on origin\n \t /\n     D---E---F---G master\n \t^\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 8cf8f68..bccaf27 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -16,7 +16,7 @@ cd_to_toplevel\n \n \n warn () {\n-\tprintf >&2 '%s\\n' \"$*\"\n+\tprintf >&2 'warning: %s\\n' \"$*\"\n }\n \n die_conflict () {\n@@ -57,7 +57,7 @@ then\n \tmode=$(git config pull.mode)\n fi\n case \"$mode\" in\n-merge|rebase|merge-ff-only|'')\n+merge|rebase|ff-only|'')\n \t;;\n rebase-preserve)\n \tmode=\"rebase\"\n@@ -69,7 +69,7 @@ rebase-preserve)\n \texit 1\n \t;;\n esac\n-\n+# backwards compatibility\n if test -z \"$mode\"\n then\n \trebase=$(bool_or_string_config branch.$curr_branch_short.rebase)\n@@ -77,13 +77,8 @@ then\n \tthen\n \t\trebase=$(bool_or_string_config pull.rebase)\n \tfi\n-\tif test -n \"$rebase\"\n-\tthen\n-\t\twarn \"$(gettext \"The configurations pull.rebase and branch.<name>.rebase are deprecated.\")\"\n-\t\twarn \"$(gettext \"Please use pull.mode and branch.<name>.pullmode instead.\")\"\n-\tfi\n fi\n-test -z \"$mode\" && mode=merge-ff-only\n+test -z \"$mode\" && mode=ff-only\n dry_run=\n while :\n do\n@@ -322,7 +317,7 @@ case \"$merge_head\" in\n *)\n \t# check if a non-fast-foward merge would be needed\n \tmerge_head=${merge_head% }\n-\tif test \"$mode\" = merge-ff-only -a -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n+\tif test \"$mode\" = 'ff-only' && test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n \t\ttest -n \"$orig_head\" &&\n \t\t! git merge-base --is-ancestor \"$orig_head\" \"$merge_head\" &&\n \t\t! git merge-base --is-ancestor \"$merge_head\" \"$orig_head\"\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 2e2b476..dc7749b 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -365,9 +365,9 @@ test_expect_success 'git pull --rebase against local branch' '\n \ttest file = \"$(cat file2)\"\n '\n \n-test_expect_success 'git pull fast-forward' '\n+test_expect_success 'git pull fast-forward (ff-only)' '\n \ttest_when_finished \"git checkout master && git branch -D other test\" &&\n-\ttest_config pull.mode merge-ff-only &&\n+\ttest_config pull.mode ff-only &&\n \tgit checkout -b other master &&\n \t>new &&\n \tgit add new &&\n@@ -377,9 +377,9 @@ test_expect_success 'git pull fast-forward' '\n \tgit pull\n '\n \n-test_expect_success 'git pull non-fast-forward' '\n+test_expect_success 'git pull non-fast-forward (ff-only)' '\n \ttest_when_finished \"git checkout master && git branch -D other test\" &&\n-\ttest_config pull.mode merge-ff-only &&\n+\ttest_config pull.mode ff-only &&\n \tgit checkout -b other master^ &&\n \t>new &&\n \tgit add new &&\n@@ -389,9 +389,9 @@ test_expect_success 'git pull non-fast-forward' '\n \ttest_must_fail git pull\n '\n \n-test_expect_success 'git pull non-fast-forward (merge)' '\n+test_expect_success 'git pull non-fast-forward with merge (ff-only)' '\n \ttest_when_finished \"git checkout master && git branch -D other test\" &&\n-\ttest_config pull.mode merge-ff-only &&\n+\ttest_config pull.mode ff-only &&\n \tgit checkout -b other master^ &&\n \t>new &&\n \tgit add new &&\n@@ -401,4 +401,15 @@ test_expect_success 'git pull non-fast-forward (merge)' '\n \tgit pull --merge\n '\n \n+test_expect_success 'git pull non-fast-forward (default)' '\n+\ttest_when_finished \"git checkout master && git branch -D other test\" &&\n+\tgit checkout -b other master^ &&\n+\t>new &&\n+\tgit add new &&\n+\tgit commit -m new &&\n+\tgit checkout -b test -t other &&\n+\tgit reset --hard master &&\n+\ttest_must_fail git pull\n+'\n+\n test_done\n\n\nFelipe Contreras (7):\n  pull: rename pull.rebase to pull.mode\n  pull: migrate all the tests to pull.mode\n  pull: refactor $rebase variable into $mode\n  pull: add --merge option\n  pull: add merge-ff-only option\n  pull: add warning on non-ff merges\n  pull: only allow ff merges by default\n\n Documentation/config.txt     |  42 ++++++++++--------\n Documentation/git-pull.txt   |  28 ++++++++++--\n branch.c                     |   4 +-\n builtin/remote.c             |  14 +++++-\n git-pull.sh                  | 100 +++++++++++++++++++++++++++++++-----------\n t/t3200-branch.sh            |  40 ++++++++---------\n t/t4013-diff-various.sh      |   2 +-\n t/t5500-fetch-pack.sh        |   2 +-\n t/t5505-remote.sh            |   2 +-\n t/t5520-pull.sh              | 101 ++++++++++++++++++++++++++++++-------------\n t/t5524-pull-msg.sh          |   2 +-\n t/t5601-clone.sh             |   4 +-\n t/t5700-clone-reference.sh   |   4 +-\n t/t6022-merge-rename.sh      |  20 ++++-----\n t/t6026-merge-attr.sh        |   2 +-\n t/t6029-merge-subtree.sh     |   6 +--\n t/t6037-merge-ours-theirs.sh |  10 ++---\n 17 files changed, 256 insertions(+), 127 deletions(-)\n\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240493","messageId":"1398988808-29678-2-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 1/7] pull: rename pull.rebase to pull.mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:02Z","receivedAt":"2014-05-02T00:00:02Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Also 'branch.<name>.rebase' to 'branch.<name>.pullmode'.\n\nThis way we can add more modes and the default can be something else,\nnamely it can be set to merge-ff-only, so eventually we can reject\nnon-fast-forward merges by default.\n\nThe old configurations still work, but get deprecated.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/config.txt   | 39 ++++++++++++++++++++++-----------------\n Documentation/git-pull.txt |  2 +-\n branch.c                   |  4 ++--\n builtin/remote.c           | 14 ++++++++++++--\n git-pull.sh                | 31 +++++++++++++++++++++++++++++--\n t/t3200-branch.sh          | 40 ++++++++++++++++++++--------------------\n t/t5601-clone.sh           |  4 ++--\n 7 files changed, 88 insertions(+), 46 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c26a7c8..c028aeb 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -708,7 +708,7 @@ branch.autosetupmerge::\n branch.autosetuprebase::\n \tWhen a new branch is created with 'git branch' or 'git checkout'\n \tthat tracks another branch, this variable tells Git to set\n-\tup pull to rebase instead of merge (see \"branch.<name>.rebase\").\n+\tup pull to rebase instead of merge (see \"branch.<name>.pullmode\").\n \tWhen `never`, rebase is never automatically set to true.\n \tWhen `local`, rebase is set to true for tracked branches of\n \tother local branches.\n@@ -764,15 +764,17 @@ branch.<name>.mergeoptions::\n \toption values containing whitespace characters are currently not\n \tsupported.\n \n-branch.<name>.rebase::\n-\tWhen true, rebase the branch <name> on top of the fetched branch,\n-\tinstead of merging the default branch from the default remote when\n-\t\"git pull\" is run. See \"pull.rebase\" for doing this in a non\n-\tbranch-specific manner.\n+branch.<name>.pullmode::\n+\tWhen \"git pull\" is run, this determines if it would either merge or\n+\trebase the fetched branch. The possible values are 'merge',\n+\t'rebase', and 'rebase-preserve'. See \"pull.mode\" for doing this in a\n+\tnon branch-specific manner.\n +\n-\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n-\tso that locally committed merge commits will not be flattened\n-\tby running 'git pull'.\n+\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n+\t'git rebase' so that locally committed merge commits will not be\n+\tflattened by running 'git pull'.\n++\n+\tIt was named 'branch.<name>.rebase' but that is deprecated now.\n +\n *NOTE*: this is a possibly dangerous operation; do *not* use\n it unless you understand the implications (see linkgit:git-rebase[1]\n@@ -1881,15 +1883,18 @@ pretty.<name>::\n \tNote that an alias with the same name as a built-in format\n \twill be silently ignored.\n \n-pull.rebase::\n-\tWhen true, rebase branches on top of the fetched branch, instead\n-\tof merging the default branch from the default remote when \"git\n-\tpull\" is run. See \"branch.<name>.rebase\" for setting this on a\n-\tper-branch basis.\n+pull.mode::\n+\tWhen \"git pull\" is run, this determines if it would either merge or\n+\trebase the fetched branch. The possible values are 'merge',\n+\t'rebase', and 'rebase-preserve'. See \"branch.<name>.pullmode\" for doing\n+\tthis in a non branch-specific manner.\n++\n+\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n+\t'git rebase' so that locally committed merge commits will not be\n+\tflattened by running 'git pull'.\n++\n +\n-\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n-\tso that locally committed merge commits will not be flattened\n-\tby running 'git pull'.\n+\tIt was named 'pull.rebase' but that is deprecated now.\n +\n *NOTE*: this is a possibly dangerous operation; do *not* use\n it unless you understand the implications (see linkgit:git-rebase[1]\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex 200eb22..9a91b9f 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -117,7 +117,7 @@ locally created merge commits will not be flattened.\n +\n When false, merge the current branch into the upstream branch.\n +\n-See `pull.rebase`, `branch.<name>.rebase` and `branch.autosetuprebase` in\n+See `pull.mode`, `branch.<name>.pullmode` and `branch.autosetuprebase` in\n linkgit:git-config[1] if you want to make `git pull` always use\n `--rebase` instead of merging.\n +\ndiff --git a/branch.c b/branch.c\nindex 723a36b..63ce671 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -71,8 +71,8 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \n \tif (rebasing) {\n \t\tstrbuf_reset(&key);\n-\t\tstrbuf_addf(&key, \"branch.%s.rebase\", local);\n-\t\tgit_config_set(key.buf, \"true\");\n+\t\tstrbuf_addf(&key, \"branch.%s.pullmode\", local);\n+\t\tgit_config_set(key.buf, \"rebase\");\n \t}\n \tstrbuf_release(&key);\n \ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex b3ab4cf..46d3c4d 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -264,7 +264,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\tchar *name;\n \t\tstruct string_list_item *item;\n \t\tstruct branch_info *info;\n-\t\tenum { REMOTE, MERGE, REBASE } type;\n+\t\tenum { REMOTE, MERGE, REBASE, PULLMODE } type;\n \n \t\tkey += 7;\n \t\tif (ends_with(key, \".remote\")) {\n@@ -276,6 +276,9 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t} else if (ends_with(key, \".rebase\")) {\n \t\t\tname = xstrndup(key, strlen(key) - 7);\n \t\t\ttype = REBASE;\n+\t\t} else if (ends_with(key, \".pullmode\")) {\n+\t\t\tname = xstrndup(key, strlen(key) - 9);\n+\t\t\ttype = PULLMODE;\n \t\t} else\n \t\t\treturn 0;\n \n@@ -299,12 +302,19 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t\t\tspace = strchr(value, ' ');\n \t\t\t}\n \t\t\tstring_list_append(&info->merge, xstrdup(value));\n-\t\t} else {\n+\t\t} else if (type == REBASE) {\n \t\t\tint v = git_config_maybe_bool(orig_key, value);\n \t\t\tif (v >= 0)\n \t\t\t\tinfo->rebase = v;\n \t\t\telse if (!strcmp(value, \"preserve\"))\n \t\t\t\tinfo->rebase = 1;\n+\t\t} else {\n+\t\t\tif (!strcmp(value, \"rebase\"))\n+\t\t\t\tinfo->rebase = 1;\n+\t\t\telse if (!strcmp(value, \"merge\"))\n+\t\t\t\tinfo->rebase = 0;\n+\t\t\telse if (!strcmp(value, \"rebase-preserve\"))\n+\t\t\t\tinfo->rebase = 1;\n \t\t}\n \t}\n \treturn 0;\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 0a5aa2c..3dbf9cf 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -47,10 +47,37 @@ log_arg= verbosity= progress= recurse_submodules= verify_signatures=\n merge_args= edit= rebase_args=\n curr_branch=$(git symbolic-ref -q HEAD)\n curr_branch_short=\"${curr_branch#refs/heads/}\"\n-rebase=$(bool_or_string_config branch.$curr_branch_short.rebase)\n+mode=$(git config branch.${curr_branch_short}.pullmode)\n+if test -z \"$mode\"\n+then\n+\tmode=$(git config pull.mode)\n+fi\n+case \"$mode\" in\n+merge)\n+\trebase=\"false\"\n+\t;;\n+rebase)\n+\trebase=\"true\"\n+\t;;\n+rebase-preserve)\n+\trebase=\"preserve\"\n+\t;;\n+'')\n+\t;;\n+*)\n+\techo \"Invalid value for 'mode'\"\n+\tusage\n+\texit 1\n+\t;;\n+esac\n+# backwards compatibility\n if test -z \"$rebase\"\n then\n-\trebase=$(bool_or_string_config pull.rebase)\n+\trebase=$(bool_or_string_config branch.$curr_branch_short.rebase)\n+\tif test -z \"$rebase\"\n+\tthen\n+\t\trebase=$(bool_or_string_config pull.rebase)\n+\tfi\n fi\n dry_run=\n while :\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex fcdb867..b79aa75 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -559,7 +559,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '\n \tgit branch --track myr1 mybase &&\n \ttest \"$(git config branch.myr1.remote)\" = . &&\n \ttest \"$(git config branch.myr1.merge)\" = refs/heads/mybase &&\n-\ttest \"$(git config branch.myr1.rebase)\" = true\n+\ttest \"$(git config branch.myr1.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase always on a tracked local branch' '\n@@ -571,7 +571,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' '\n \tgit branch --track myr2 mybase &&\n \ttest \"$(git config branch.myr2.remote)\" = . &&\n \ttest \"$(git config branch.myr2.merge)\" = refs/heads/mybase &&\n-\ttest \"$(git config branch.myr2.rebase)\" = true\n+\ttest \"$(git config branch.myr2.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase remote on a tracked local branch' '\n@@ -583,7 +583,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' '\n \tgit branch --track myr3 mybase2 &&\n \ttest \"$(git config branch.myr3.remote)\" = . &&\n \ttest \"$(git config branch.myr3.merge)\" = refs/heads/mybase2 &&\n-\t! test \"$(git config branch.myr3.rebase)\" = true\n+\t! test \"$(git config branch.myr3.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase never on a tracked local branch' '\n@@ -595,7 +595,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' '\n \tgit branch --track myr4 mybase2 &&\n \ttest \"$(git config branch.myr4.remote)\" = . &&\n \ttest \"$(git config branch.myr4.merge)\" = refs/heads/mybase2 &&\n-\t! test \"$(git config branch.myr4.rebase)\" = true\n+\t! test \"$(git config branch.myr4.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase local on a tracked remote branch' '\n@@ -606,7 +606,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' '\n \tgit branch --track myr5 local/master &&\n \ttest \"$(git config branch.myr5.remote)\" = local &&\n \ttest \"$(git config branch.myr5.merge)\" = refs/heads/master &&\n-\t! test \"$(git config branch.myr5.rebase)\" = true\n+\t! test \"$(git config branch.myr5.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase never on a tracked remote branch' '\n@@ -617,7 +617,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' '\n \tgit branch --track myr6 local/master &&\n \ttest \"$(git config branch.myr6.remote)\" = local &&\n \ttest \"$(git config branch.myr6.merge)\" = refs/heads/master &&\n-\t! test \"$(git config branch.myr6.rebase)\" = true\n+\t! test \"$(git config branch.myr6.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n@@ -628,7 +628,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' '\n \tgit branch --track myr7 local/master &&\n \ttest \"$(git config branch.myr7.remote)\" = local &&\n \ttest \"$(git config branch.myr7.merge)\" = refs/heads/master &&\n-\ttest \"$(git config branch.myr7.rebase)\" = true\n+\ttest \"$(git config branch.myr7.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase always on a tracked remote branch' '\n@@ -639,7 +639,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' '\n \tgit branch --track myr8 local/master &&\n \ttest \"$(git config branch.myr8.remote)\" = local &&\n \ttest \"$(git config branch.myr8.merge)\" = refs/heads/master &&\n-\ttest \"$(git config branch.myr8.rebase)\" = true\n+\ttest \"$(git config branch.myr8.pullmode)\" = rebase\n '\n \n test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '\n@@ -650,7 +650,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '\n \tgit branch --track myr9 local/master &&\n \ttest \"$(git config branch.myr9.remote)\" = local &&\n \ttest \"$(git config branch.myr9.merge)\" = refs/heads/master &&\n-\ttest \"z$(git config branch.myr9.rebase)\" = z\n+\ttest \"z$(git config branch.myr9.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '\n@@ -661,7 +661,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '\n \tgit branch --track myr10 mybase2 &&\n \ttest \"$(git config branch.myr10.remote)\" = . &&\n \ttest \"$(git config branch.myr10.merge)\" = refs/heads/mybase2 &&\n-\ttest \"z$(git config branch.myr10.rebase)\" = z\n+\ttest \"z$(git config branch.myr10.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase unconfigured on untracked local branch' '\n@@ -671,7 +671,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '\n \tgit branch --no-track myr11 mybase2 &&\n \ttest \"z$(git config branch.myr11.remote)\" = z &&\n \ttest \"z$(git config branch.myr11.merge)\" = z &&\n-\ttest \"z$(git config branch.myr11.rebase)\" = z\n+\ttest \"z$(git config branch.myr11.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '\n@@ -681,7 +681,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '\n \tgit branch --no-track myr12 local/master &&\n \ttest \"z$(git config branch.myr12.remote)\" = z &&\n \ttest \"z$(git config branch.myr12.merge)\" = z &&\n-\ttest \"z$(git config branch.myr12.rebase)\" = z\n+\ttest \"z$(git config branch.myr12.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase never on an untracked local branch' '\n@@ -692,7 +692,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' '\n \tgit branch --no-track myr13 mybase2 &&\n \ttest \"z$(git config branch.myr13.remote)\" = z &&\n \ttest \"z$(git config branch.myr13.merge)\" = z &&\n-\ttest \"z$(git config branch.myr13.rebase)\" = z\n+\ttest \"z$(git config branch.myr13.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase local on an untracked local branch' '\n@@ -703,7 +703,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' '\n \tgit branch --no-track myr14 mybase2 &&\n \ttest \"z$(git config branch.myr14.remote)\" = z &&\n \ttest \"z$(git config branch.myr14.merge)\" = z &&\n-\ttest \"z$(git config branch.myr14.rebase)\" = z\n+\ttest \"z$(git config branch.myr14.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase remote on an untracked local branch' '\n@@ -714,7 +714,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' '\n \tgit branch --no-track myr15 mybase2 &&\n \ttest \"z$(git config branch.myr15.remote)\" = z &&\n \ttest \"z$(git config branch.myr15.merge)\" = z &&\n-\ttest \"z$(git config branch.myr15.rebase)\" = z\n+\ttest \"z$(git config branch.myr15.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase always on an untracked local branch' '\n@@ -725,7 +725,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' '\n \tgit branch --no-track myr16 mybase2 &&\n \ttest \"z$(git config branch.myr16.remote)\" = z &&\n \ttest \"z$(git config branch.myr16.merge)\" = z &&\n-\ttest \"z$(git config branch.myr16.rebase)\" = z\n+\ttest \"z$(git config branch.myr16.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase never on an untracked remote branch' '\n@@ -736,7 +736,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' '\n \tgit branch --no-track myr17 local/master &&\n \ttest \"z$(git config branch.myr17.remote)\" = z &&\n \ttest \"z$(git config branch.myr17.merge)\" = z &&\n-\ttest \"z$(git config branch.myr17.rebase)\" = z\n+\ttest \"z$(git config branch.myr17.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase local on an untracked remote branch' '\n@@ -747,7 +747,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' '\n \tgit branch --no-track myr18 local/master &&\n \ttest \"z$(git config branch.myr18.remote)\" = z &&\n \ttest \"z$(git config branch.myr18.merge)\" = z &&\n-\ttest \"z$(git config branch.myr18.rebase)\" = z\n+\ttest \"z$(git config branch.myr18.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n@@ -758,7 +758,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' '\n \tgit branch --no-track myr19 local/master &&\n \ttest \"z$(git config branch.myr19.remote)\" = z &&\n \ttest \"z$(git config branch.myr19.merge)\" = z &&\n-\ttest \"z$(git config branch.myr19.rebase)\" = z\n+\ttest \"z$(git config branch.myr19.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase always on an untracked remote branch' '\n@@ -769,7 +769,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '\n \tgit branch --no-track myr20 local/master &&\n \ttest \"z$(git config branch.myr20.remote)\" = z &&\n \ttest \"z$(git config branch.myr20.merge)\" = z &&\n-\ttest \"z$(git config branch.myr20.rebase)\" = z\n+\ttest \"z$(git config branch.myr20.pullmode)\" = z\n '\n \n test_expect_success 'autosetuprebase always on detached HEAD' '\ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nindex 5e67035..0e91b67 100755\n--- a/t/t5601-clone.sh\n+++ b/t/t5601-clone.sh\n@@ -191,8 +191,8 @@ test_expect_success 'clone respects global branch.autosetuprebase' '\n \t\trm -fr dst &&\n \t\tgit clone src dst &&\n \t\tcd dst &&\n-\t\tactual=\"z$(git config branch.master.rebase)\" &&\n-\t\ttest ztrue = $actual\n+\t\tactual=\"$(git config branch.master.pullmode)\" &&\n+\t\ttest \"$actual\" = rebase\n \t)\n '\n \n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240494","messageId":"1398988808-29678-3-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 2/7] pull: migrate all the tests to pull.mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:03Z","receivedAt":"2014-05-02T00:00:03Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"And branch.$name.pullmode.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n t/t5505-remote.sh |  2 +-\n t/t5520-pull.sh   | 54 +++++++++++++++++++++++-------------------------------\n 2 files changed, 24 insertions(+), 32 deletions(-)\n\ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex ac79dd9..76376e4 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -181,7 +181,7 @@ test_expect_success 'show' '\n \t\tgit branch -d -r origin/master &&\n \t\tgit config --add remote.two.url ../two &&\n \t\tgit config --add remote.two.pushurl ../three &&\n-\t\tgit config branch.rebase.rebase true &&\n+\t\tgit config branch.rebase.pullmode rebase &&\n \t\tgit config branch.octopus.merge \"topic-a topic-b topic-c\" &&\n \t\t(\n \t\t\tcd ../one &&\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 227d293..01ad17a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -123,26 +123,26 @@ test_expect_success '--rebase' '\n \ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n \ttest new = $(git show HEAD:file2)\n '\n-test_expect_success 'pull.rebase' '\n+test_expect_success 'pull.mode=rebase' '\n \tgit reset --hard before-rebase &&\n-\ttest_config pull.rebase true &&\n+\ttest_config pull.mode rebase &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n \ttest new = $(git show HEAD:file2)\n '\n \n-test_expect_success 'branch.to-rebase.rebase' '\n+test_expect_success 'branch.to-rebase.pullmode=rebase' '\n \tgit reset --hard before-rebase &&\n-\ttest_config branch.to-rebase.rebase true &&\n+\ttest_config branch.to-rebase.pullmode rebase &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n \ttest new = $(git show HEAD:file2)\n '\n \n-test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n+test_expect_success 'branch.to-rebase.pullmode should override pull.mode' '\n \tgit reset --hard before-rebase &&\n-\ttest_config pull.rebase true &&\n-\ttest_config branch.to-rebase.rebase false &&\n+\ttest_config pull.mode merge &&\n+\ttest_config branch.to-rebase.pullmode merge &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^) != $(git rev-parse copy) &&\n \ttest new = $(git show HEAD:file2)\n@@ -150,7 +150,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \n # add a feature branch, keep-merge, that is merged into master, so the\n # test can try preserving the merge commit (or not) with various\n-# --rebase flags/pull.rebase settings.\n+# --rebase flags/pull.mode settings.\n test_expect_success 'preserve merge setup' '\n \tgit reset --hard before-rebase &&\n \tgit checkout -b keep-merge second^ &&\n@@ -160,48 +160,40 @@ test_expect_success 'preserve merge setup' '\n \tgit tag before-preserve-rebase\n '\n \n-test_expect_success 'pull.rebase=false create a new merge commit' '\n+test_expect_success 'pull.mode=merge create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase false &&\n+\ttest_config pull.mode merge &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^1) = $(git rev-parse before-preserve-rebase) &&\n \ttest $(git rev-parse HEAD^2) = $(git rev-parse copy) &&\n \ttest file3 = $(git show HEAD:file3.t)\n '\n \n-test_expect_success 'pull.rebase=true flattens keep-merge' '\n+test_expect_success 'pull.mode=rebase flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase true &&\n+\ttest_config pull.mode rebase &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n \ttest file3 = $(git show HEAD:file3.t)\n '\n \n-test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n+test_expect_success 'pull.mode=rebase-preserve rebases and merges keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase 1 &&\n-\tgit pull . copy &&\n-\ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n-\ttest file3 = $(git show HEAD:file3.t)\n-'\n-\n-test_expect_success 'pull.rebase=preserve rebases and merges keep-merge' '\n-\tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase preserve &&\n+\ttest_config pull.mode rebase-preserve &&\n \tgit pull . copy &&\n \ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n \ttest $(git rev-parse HEAD^2) = $(git rev-parse keep-merge)\n '\n \n-test_expect_success 'pull.rebase=invalid fails' '\n+test_expect_success 'pull.mode=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase invalid &&\n+\ttest_config pull.mode invalid &&\n \t! git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase true &&\n+\ttest_config pull.mode rebase &&\n \tgit pull --rebase=false . copy &&\n \ttest $(git rev-parse HEAD^1) = $(git rev-parse before-preserve-rebase) &&\n \ttest $(git rev-parse HEAD^2) = $(git rev-parse copy) &&\n@@ -210,7 +202,7 @@ test_expect_success '--rebase=false create a new merge commit' '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase preserve &&\n+\ttest_config pull.mode rebase-preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n \ttest file3 = $(git show HEAD:file3.t)\n@@ -218,7 +210,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \n test_expect_success '--rebase=preserve rebases and merges keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase true &&\n+\ttest_config pull.mode rebase &&\n \tgit pull --rebase=preserve . copy &&\n \ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n \ttest $(git rev-parse HEAD^2) = $(git rev-parse keep-merge)\n@@ -229,9 +221,9 @@ test_expect_success '--rebase=invalid fails' '\n \t! git pull --rebase=invalid . copy\n '\n \n-test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n+test_expect_success '--rebase overrides pull.mode=rebase-preserve and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n-\ttest_config pull.rebase preserve &&\n+\ttest_config pull.mode rebase-preserve &&\n \tgit pull --rebase . copy &&\n \ttest $(git rev-parse HEAD^^) = $(git rev-parse copy) &&\n \ttest file3 = $(git show HEAD:file3.t)\n@@ -279,7 +271,7 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \n '\n \n-test_expect_success 'pull --rebase dies early with dirty working directory' '\n+test_expect_success 'pull --mode=rebase dies early with dirty working directory' '\n \n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n@@ -287,7 +279,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit rebase --onto $COPY copy &&\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n-\ttest_config branch.to-rebase.rebase true &&\n+\ttest_config branch.to-rebase.pullmode rebase &&\n \techo dirty >> file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240499","messageId":"1398988808-29678-4-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 3/7] pull: refactor $rebase variable into $mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:04Z","receivedAt":"2014-05-02T00:00:04Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n git-pull.sh | 64 +++++++++++++++++++++++++++++++------------------------------\n 1 file changed, 33 insertions(+), 31 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 3dbf9cf..50c612f 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -53,16 +53,11 @@ then\n \tmode=$(git config pull.mode)\n fi\n case \"$mode\" in\n-merge)\n-\trebase=\"false\"\n-\t;;\n-rebase)\n-\trebase=\"true\"\n+merge|rebase|'')\n \t;;\n rebase-preserve)\n-\trebase=\"preserve\"\n-\t;;\n-'')\n+\tmode=\"rebase\"\n+\trebase_args=\"--preserve-merges\"\n \t;;\n *)\n \techo \"Invalid value for 'mode'\"\n@@ -71,7 +66,7 @@ rebase-preserve)\n \t;;\n esac\n # backwards compatibility\n-if test -z \"$rebase\"\n+if test -z \"$mode\"\n then\n \trebase=$(bool_or_string_config branch.$curr_branch_short.rebase)\n \tif test -z \"$rebase\"\n@@ -145,10 +140,10 @@ do\n \t\trebase=\"${1#*=}\"\n \t\t;;\n \t-r|--r|--re|--reb|--reba|--rebas|--rebase)\n-\t\trebase=true\n+\t\tmode=rebase\n \t\t;;\n \t--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)\n-\t\trebase=false\n+\t\tmode=\n \t\t;;\n \t--recurse-submodules)\n \t\trecurse_submodules=--recurse-submodules\n@@ -179,19 +174,26 @@ do\n \tshift\n done\n \n-case \"$rebase\" in\n-preserve)\n-\trebase=true\n-\trebase_args=--preserve-merges\n-\t;;\n-true|false|'')\n-\t;;\n-*)\n-\techo \"Invalid value for --rebase, should be true, false, or preserve\"\n-\tusage\n-\texit 1\n-\t;;\n-esac\n+if test -n \"$rebase\"\n+then\n+\tcase \"$rebase\" in\n+\ttrue)\n+\t\tmode=\"rebase\"\n+\t\t;;\n+\tfalse)\n+\t\tmode=\"merge\"\n+\t\t;;\n+\tpreserve)\n+\t\tmode=\"rebase\"\n+\t\trebase_args=--preserve-merges\n+\t\t;;\n+\t*)\n+\t\techo \"Invalid value for --rebase, should be true, false, or preserve\"\n+\t\tusage\n+\t\texit 1\n+\t\t;;\n+\tesac\n+fi\n \n error_on_no_merge_candidates () {\n \texec >&2\n@@ -205,7 +207,7 @@ error_on_no_merge_candidates () {\n \t\tesac\n \tdone\n \n-\tif test true = \"$rebase\"\n+\tif test \"$mode\" = rebase\n \tthen\n \t\top_type=rebase\n \t\top_prep=against\n@@ -218,7 +220,7 @@ error_on_no_merge_candidates () {\n \tremote=$(git config \"branch.$curr_branch_short.remote\")\n \n \tif [ $# -gt 1 ]; then\n-\t\tif [ \"$rebase\" = true ]; then\n+\t\tif [ \"$mode\" = rebase ]; then\n \t\t\tprintf \"There is no candidate for rebasing against \"\n \t\telse\n \t\t\tprintf \"There are no candidates for merging \"\n@@ -241,7 +243,7 @@ error_on_no_merge_candidates () {\n \texit 1\n }\n \n-test true = \"$rebase\" && {\n+test \"$mode\" = rebase && {\n \tif ! git rev-parse -q --verify HEAD >/dev/null\n \tthen\n \t\t# On an unborn branch\n@@ -298,7 +300,7 @@ case \"$merge_head\" in\n \tthen\n \t\tdie \"$(gettext \"Cannot merge multiple branches into empty head\")\"\n \tfi\n-\tif test true = \"$rebase\"\n+\tif test \"$mode\" = rebase\n \tthen\n \t\tdie \"$(gettext \"Cannot rebase onto multiple branches\")\"\n \tfi\n@@ -319,7 +321,7 @@ then\n \texit\n fi\n \n-if test true = \"$rebase\"\n+if test \"$mode\" = rebase\n then\n \to=$(git show-branch --merge-base $curr_branch $merge_head $oldremoteref)\n \tif test \"$oldremoteref\" = \"$o\"\n@@ -329,8 +331,8 @@ then\n fi\n \n merge_name=$(git fmt-merge-msg $log_arg <\"$GIT_DIR/FETCH_HEAD\") || exit\n-case \"$rebase\" in\n-true)\n+case \"$mode\" in\n+rebase)\n \teval=\"git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity\"\n \teval=\"$eval --onto $merge_head ${oldremoteref:-$merge_head}\"\n \t;;\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240498","messageId":"1398988808-29678-5-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 4/7] pull: add --merge option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:05Z","receivedAt":"2014-05-02T00:00:05Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Also, deprecate --no-rebase since there's no need for it any more.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-pull.txt |  8 ++++++--\n git-pull.sh                | 10 +++++++++-\n 2 files changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex 9a91b9f..767bca3 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you\n published that history already.  Do *not* use this option\n unless you have read linkgit:git-rebase[1] carefully.\n \n---no-rebase::\n-\tOverride earlier --rebase.\n+-m::\n+--merge::\n+\tForce a merge.\n++\n+See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want\n+to make `git pull` always use `--merge`.\n \n Options related to fetching\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 50c612f..e7e52ec 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -15,6 +15,10 @@ require_work_tree_exists\n cd_to_toplevel\n \n \n+warn () {\n+\tprintf >&2 'warning: %s\\n' \"$*\"\n+}\n+\n die_conflict () {\n     git diff-index --cached --name-status -r --ignore-submodules HEAD --\n     if [ $(git config --bool --get advice.resolveConflict || echo true) = \"true\" ]; then\n@@ -142,8 +146,12 @@ do\n \t-r|--r|--re|--reb|--reba|--rebas|--rebase)\n \t\tmode=rebase\n \t\t;;\n+\t-m|--m|--me|--mer|--merg|--merge)\n+\t\tmode=merge\n+\t\t;;\n \t--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)\n-\t\tmode=\n+\t\tmode=merge\n+\t\twarn \"$(gettext \"--no-rebase is deprecated, please use --merge instead\")\"\n \t\t;;\n \t--recurse-submodules)\n \t\trecurse_submodules=--recurse-submodules\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240496","messageId":"1398988808-29678-6-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 5/7] pull: add merge-ff-only option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:06Z","receivedAt":"2014-05-02T00:00:06Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"It is very typical for Git newcomers to inadvertently create merges and\nworst; inadvertently pushing them. This is one of the reasons many\nexperienced users prefer to avoid 'git pull', and recommend newcomers to\navoid it as well.\n\nTo avoid these problems and keep 'git pull' useful, it has been\nsuggested that 'git pull' barfs by default if the merge is\nnon-fast-forward, which unfortunately would break backwards\ncompatibility.\n\nThis patch leaves everything in place to enable this new mode, but it\nonly gets enabled if the user specifically configures it; pull.mode =\nmerge-ff-only.\n\nLater on this mode can be enabled by default.\n\nFor the full discussion you can read:\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/225146/focus=225305\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/config.txt |  7 +++++--\n git-pull.sh              | 15 ++++++++++++++-\n t/t5520-pull.sh          | 36 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 55 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c028aeb..b391ec1 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1886,8 +1886,11 @@ pretty.<name>::\n pull.mode::\n \tWhen \"git pull\" is run, this determines if it would either merge or\n \trebase the fetched branch. The possible values are 'merge',\n-\t'rebase', and 'rebase-preserve'. See \"branch.<name>.pullmode\" for doing\n-\tthis in a non branch-specific manner.\n+\t'rebase', 'ff-only,' and 'rebase-preserve'.\n+\tIf 'ff-only' is specified, the merge will only succeed if it's\n+\tfast-forward.\n+\tSee \"branch.<name>.pullmode\" for doing this in a non branch-specific\n+\tmanner.\n +\n \tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n \t'git rebase' so that locally committed merge commits will not be\ndiff --git a/git-pull.sh b/git-pull.sh\nindex e7e52ec..2446417 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -57,7 +57,7 @@ then\n \tmode=$(git config pull.mode)\n fi\n case \"$mode\" in\n-merge|rebase|'')\n+merge|rebase|ff-only|'')\n \t;;\n rebase-preserve)\n \tmode=\"rebase\"\n@@ -78,6 +78,7 @@ then\n \t\trebase=$(bool_or_string_config pull.rebase)\n \tfi\n fi\n+test -z \"$mode\" && mode=merge\n dry_run=\n while :\n do\n@@ -313,6 +314,18 @@ case \"$merge_head\" in\n \t\tdie \"$(gettext \"Cannot rebase onto multiple branches\")\"\n \tfi\n \t;;\n+*)\n+\t# check if a non-fast-foward merge would be needed\n+\tmerge_head=${merge_head% }\n+\tif test \"$mode\" = 'ff-only' && test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n+\t\ttest -n \"$orig_head\" &&\n+\t\t! git merge-base --is-ancestor \"$orig_head\" \"$merge_head\" &&\n+\t\t! git merge-base --is-ancestor \"$merge_head\" \"$orig_head\"\n+\tthen\n+\t\tdie \"$(gettext \"The pull was not fast-forward, please either merge or rebase.\n+If unsure, run 'git pull --merge'.\")\"\n+\tfi\n+\t;;\n esac\n \n # Pulling into unborn branch: a shorthand for branching off\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 01ad17a..a548c1b 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -365,4 +365,40 @@ test_expect_success 'git pull --rebase against local branch' '\n \ttest file = \"$(cat file2)\"\n '\n \n+test_expect_success 'git pull fast-forward (ff-only)' '\n+\ttest_when_finished \"git checkout master && git branch -D other test\" &&\n+\ttest_config pull.mode ff-only &&\n+\tgit checkout -b other master &&\n+\t>new &&\n+\tgit add new &&\n+\tgit commit -m new &&\n+\tgit checkout -b test -t other &&\n+\tgit reset --hard master &&\n+\tgit pull\n+'\n+\n+test_expect_success 'git pull non-fast-forward (ff-only)' '\n+\ttest_when_finished \"git checkout master && git branch -D other test\" &&\n+\ttest_config pull.mode ff-only &&\n+\tgit checkout -b other master^ &&\n+\t>new &&\n+\tgit add new &&\n+\tgit commit -m new &&\n+\tgit checkout -b test -t other &&\n+\tgit reset --hard master &&\n+\ttest_must_fail git pull\n+'\n+\n+test_expect_success 'git pull non-fast-forward with merge (ff-only)' '\n+\ttest_when_finished \"git checkout master && git branch -D other test\" &&\n+\ttest_config pull.mode ff-only &&\n+\tgit checkout -b other master^ &&\n+\t>new &&\n+\tgit add new &&\n+\tgit commit -m new &&\n+\tgit checkout -b test -t other &&\n+\tgit reset --hard master &&\n+\tgit pull --merge\n+'\n+\n test_done\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240497","messageId":"1398988808-29678-7-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 6/7] pull: add warning on non-ff merges","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:07Z","receivedAt":"2014-05-02T00:00:07Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"To prepare our uses for the upcoming changes we should warn them and let\nthem know that they will need to specify a merge or a rebase in the\nfuture (when a non-fast-forward situation arises). Also, let them know\nwe fallback to 'git pull --merge', so when the obsoletion of this mode\ncomes, they know what to type without interrupting or changing their\nworkflow.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-pull.txt | 18 ++++++++++++++++++\n git-pull.sh                | 15 ++++++++++++---\n t/t5520-pull.sh            | 14 ++++++++++++++\n 3 files changed, 44 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex 767bca3..fe3d15d 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -23,6 +23,7 @@ More precisely, 'git pull' runs 'git fetch' with the given\n parameters and calls 'git merge' to merge the retrieved branch\n heads into the current branch.\n With `--rebase`, it runs 'git rebase' instead of 'git merge'.\n+With `--merge`, it forces the merge, even if it's non-fast forward.\n \n <repository> should be the name of a remote repository as\n passed to linkgit:git-fetch[1].  <refspec> can name an\n@@ -41,11 +42,28 @@ Assume the following history exists and the current branch is\n ------------\n \t  A---B---C master on origin\n \t /\n+    D---E master\n+------------\n+\n+Then `git pull` will merge in a fast-foward way up to the new master.\n+\n+------------\n+    D---E---A---B---C master, origin/master\n+------------\n+\n+However, a non-fast-foward case looks very different.\n+\n+------------\n+\t  A---B---C master on origin\n+\t /\n     D---E---F---G master\n \t^\n \torigin/master in your repository\n ------------\n \n+By default `git pull` will warn about these situations, however, most likely\n+you would want to force a merge, which you can do with `git pull --merge`.\n+\n Then \"`git pull`\" will fetch and replay the changes from the remote\n `master` branch since it diverged from the local `master` (i.e., `E`)\n until its current commit (`C`) on top of `master` and record the\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 2446417..c4a0b08 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -78,7 +78,7 @@ then\n \t\trebase=$(bool_or_string_config pull.rebase)\n \tfi\n fi\n-test -z \"$mode\" && mode=merge\n+test -z \"$mode\" && mode=default\n dry_run=\n while :\n do\n@@ -317,13 +317,22 @@ case \"$merge_head\" in\n *)\n \t# check if a non-fast-foward merge would be needed\n \tmerge_head=${merge_head% }\n-\tif test \"$mode\" = 'ff-only' && test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n+\tif test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n \t\ttest -n \"$orig_head\" &&\n \t\t! git merge-base --is-ancestor \"$orig_head\" \"$merge_head\" &&\n \t\t! git merge-base --is-ancestor \"$merge_head\" \"$orig_head\"\n \tthen\n-\t\tdie \"$(gettext \"The pull was not fast-forward, please either merge or rebase.\n+\t\tcase \"$mode\" in\n+\t\tff-only)\n+\t\t\tdie \"$(gettext \"The pull was not fast-forward, please either merge or rebase.\n If unsure, run 'git pull --merge'.\")\"\n+\t\t\t;;\n+\t\tdefault)\n+\t\t\twarn \"$(gettext \"the pull was not fast-forward, in the future you would have to choose\n+a merge or a rebase, falling back to old style for now (git pull --merge).\n+Read 'git pull --help' for more information.\")\" >&2\n+\t\t\t;;\n+\t\tesac\n \tfi\n \t;;\n esac\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a548c1b..c96834e 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -401,4 +401,18 @@ test_expect_success 'git pull non-fast-forward with merge (ff-only)' '\n \tgit pull --merge\n '\n \n+test_expect_success 'git pull non-fast-forward (default)' '\n+\ttest_when_finished \"git checkout master && git branch -D other test\" &&\n+\tgit checkout -b other master^ &&\n+\t>new &&\n+\tgit add new &&\n+\tgit commit -m new &&\n+\tgit checkout -b test -t other &&\n+\tgit reset --hard master &&\n+\tgit pull 2> error &&\n+\tcat error &&\n+\tgrep -q \"the pull was not fast-forward\" error &&\n+\tgrep -q \"in the future you would have to choose\" error\n+'\n+\n test_done\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240495","messageId":"1398988808-29678-8-git-send-email-felipe.contreras@gmail.com","threadId":"36565","inReplyTo":"1398988808-29678-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH v6 7/7] pull: only allow ff merges by default","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T00:00:08Z","receivedAt":"2014-05-02T00:00:08Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n Documentation/git-pull.txt   |  2 +-\n git-pull.sh                  | 15 +++------------\n t/t4013-diff-various.sh      |  2 +-\n t/t5500-fetch-pack.sh        |  2 +-\n t/t5520-pull.sh              |  5 +----\n t/t5524-pull-msg.sh          |  2 +-\n t/t5700-clone-reference.sh   |  4 ++--\n t/t6022-merge-rename.sh      | 20 ++++++++++----------\n t/t6026-merge-attr.sh        |  2 +-\n t/t6029-merge-subtree.sh     |  6 +++---\n t/t6037-merge-ours-theirs.sh | 10 +++++-----\n 11 files changed, 29 insertions(+), 41 deletions(-)\n\ndiff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\nindex fe3d15d..968315c 100644\n--- a/Documentation/git-pull.txt\n+++ b/Documentation/git-pull.txt\n@@ -61,7 +61,7 @@ However, a non-fast-foward case looks very different.\n \torigin/master in your repository\n ------------\n \n-By default `git pull` will warn about these situations, however, most likely\n+By default `git pull` will fail on these situations, however, most likely\n you would want to force a merge, which you can do with `git pull --merge`.\n \n Then \"`git pull`\" will fetch and replay the changes from the remote\ndiff --git a/git-pull.sh b/git-pull.sh\nindex c4a0b08..bccaf27 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -78,7 +78,7 @@ then\n \t\trebase=$(bool_or_string_config pull.rebase)\n \tfi\n fi\n-test -z \"$mode\" && mode=default\n+test -z \"$mode\" && mode=ff-only\n dry_run=\n while :\n do\n@@ -317,22 +317,13 @@ case \"$merge_head\" in\n *)\n \t# check if a non-fast-foward merge would be needed\n \tmerge_head=${merge_head% }\n-\tif test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n+\tif test \"$mode\" = 'ff-only' && test -z \"$no_ff$ff_only${squash#--no-squash}\" &&\n \t\ttest -n \"$orig_head\" &&\n \t\t! git merge-base --is-ancestor \"$orig_head\" \"$merge_head\" &&\n \t\t! git merge-base --is-ancestor \"$merge_head\" \"$orig_head\"\n \tthen\n-\t\tcase \"$mode\" in\n-\t\tff-only)\n-\t\t\tdie \"$(gettext \"The pull was not fast-forward, please either merge or rebase.\n+\t\tdie \"$(gettext \"The pull was not fast-forward, please either merge or rebase.\n If unsure, run 'git pull --merge'.\")\"\n-\t\t\t;;\n-\t\tdefault)\n-\t\t\twarn \"$(gettext \"the pull was not fast-forward, in the future you would have to choose\n-a merge or a rebase, falling back to old style for now (git pull --merge).\n-Read 'git pull --help' for more information.\")\" >&2\n-\t\t\t;;\n-\t\tesac\n \tfi\n \t;;\n esac\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex e77c09c..1840767 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -64,7 +64,7 @@ test_expect_success setup '\n \texport GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&\n \n \tgit checkout master &&\n-\tgit pull -s ours . side &&\n+\tgit pull --merge -s ours . side &&\n \n \tGIT_AUTHOR_DATE=\"2006-06-26 00:05:00 +0000\" &&\n \tGIT_COMMITTER_DATE=\"2006-06-26 00:05:00 +0000\" &&\ndiff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\nindex 5b2b1c2..f735cfe 100755\n--- a/t/t5500-fetch-pack.sh\n+++ b/t/t5500-fetch-pack.sh\n@@ -259,7 +259,7 @@ test_expect_success 'clone shallow object count' '\n test_expect_success 'pull in shallow repo with missing merge base' '\n \t(\n \t\tcd shallow &&\n-\t\ttest_must_fail git pull --depth 4 .. A\n+\t\ttest_must_fail git pull --merge --depth 4 .. A\n \t)\n '\n \ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c96834e..dc7749b 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -409,10 +409,7 @@ test_expect_success 'git pull non-fast-forward (default)' '\n \tgit commit -m new &&\n \tgit checkout -b test -t other &&\n \tgit reset --hard master &&\n-\tgit pull 2> error &&\n-\tcat error &&\n-\tgrep -q \"the pull was not fast-forward\" error &&\n-\tgrep -q \"in the future you would have to choose\" error\n+\ttest_must_fail git pull\n '\n \n test_done\ndiff --git a/t/t5524-pull-msg.sh b/t/t5524-pull-msg.sh\nindex 8cccecc..ec9f413 100755\n--- a/t/t5524-pull-msg.sh\n+++ b/t/t5524-pull-msg.sh\n@@ -25,7 +25,7 @@ test_expect_success setup '\n test_expect_success pull '\n (\n \tcd cloned &&\n-\tgit pull --log &&\n+\tgit pull --merge --log &&\n \tgit log -2 &&\n \tgit cat-file commit HEAD >result &&\n \tgrep Dollar result\ndiff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh\nindex 6537911..306badf 100755\n--- a/t/t5700-clone-reference.sh\n+++ b/t/t5700-clone-reference.sh\n@@ -94,7 +94,7 @@ cd \"$base_dir\"\n \n test_expect_success 'pulling changes from origin' \\\n 'cd C &&\n-git pull origin'\n+git pull --merge origin'\n \n cd \"$base_dir\"\n \n@@ -109,7 +109,7 @@ cd \"$base_dir\"\n \n test_expect_success 'pulling changes from origin' \\\n 'cd D &&\n-git pull origin'\n+git pull --merge origin'\n \n cd \"$base_dir\"\n \ndiff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh\nindex a89dfbe..f63300f 100755\n--- a/t/t6022-merge-rename.sh\n+++ b/t/t6022-merge-rename.sh\n@@ -100,7 +100,7 @@ git checkout master'\n test_expect_success 'pull renaming branch into unrenaming one' \\\n '\n \tgit show-branch &&\n-\ttest_expect_code 1 git pull . white &&\n+\ttest_expect_code 1 git pull --merge . white &&\n \tgit ls-files -s &&\n \tgit ls-files -u B >b.stages &&\n \ttest_line_count = 3 b.stages &&\n@@ -118,7 +118,7 @@ test_expect_success 'pull renaming branch into another renaming one' \\\n \trm -f B &&\n \tgit reset --hard &&\n \tgit checkout red &&\n-\ttest_expect_code 1 git pull . white &&\n+\ttest_expect_code 1 git pull --merge . white &&\n \tgit ls-files -u B >b.stages &&\n \ttest_line_count = 3 b.stages &&\n \tgit ls-files -s N >n.stages &&\n@@ -134,7 +134,7 @@ test_expect_success 'pull unrenaming branch into renaming one' \\\n '\n \tgit reset --hard &&\n \tgit show-branch &&\n-\ttest_expect_code 1 git pull . master &&\n+\ttest_expect_code 1 git pull --merge . master &&\n \tgit ls-files -u B >b.stages &&\n \ttest_line_count = 3 b.stages &&\n \tgit ls-files -s N >n.stages &&\n@@ -150,7 +150,7 @@ test_expect_success 'pull conflicting renames' \\\n '\n \tgit reset --hard &&\n \tgit show-branch &&\n-\ttest_expect_code 1 git pull . blue &&\n+\ttest_expect_code 1 git pull --merge . blue &&\n \tgit ls-files -u A >a.stages &&\n \ttest_line_count = 1 a.stages &&\n \tgit ls-files -u B >b.stages &&\n@@ -170,7 +170,7 @@ test_expect_success 'interference with untracked working tree file' '\n \tgit reset --hard &&\n \tgit show-branch &&\n \techo >A this file should not matter &&\n-\ttest_expect_code 1 git pull . white &&\n+\ttest_expect_code 1 git pull --merge . white &&\n \ttest_path_is_file A\n '\n \n@@ -180,7 +180,7 @@ test_expect_success 'interference with untracked working tree file' '\n \tgit show-branch &&\n \trm -f A &&\n \techo >A this file should not matter &&\n-\ttest_expect_code 1 git pull . red &&\n+\ttest_expect_code 1 git pull --merge . red &&\n \ttest_path_is_file A\n '\n \n@@ -190,7 +190,7 @@ test_expect_success 'interference with untracked working tree file' '\n \tgit checkout -f master &&\n \tgit tag -f anchor &&\n \tgit show-branch &&\n-\tgit pull . yellow &&\n+\tgit pull --merge . yellow &&\n \ttest_path_is_missing M &&\n \tgit reset --hard anchor\n '\n@@ -203,7 +203,7 @@ test_expect_success 'updated working tree file should prevent the merge' '\n \tgit show-branch &&\n \techo >>M one line addition &&\n \tcat M >M.saved &&\n-\ttest_expect_code 128 git pull . yellow &&\n+\ttest_expect_code 128 git pull --merge . yellow &&\n \ttest_cmp M M.saved &&\n \trm -f M.saved\n '\n@@ -217,7 +217,7 @@ test_expect_success 'updated working tree file should prevent the merge' '\n \techo >>M one line addition &&\n \tcat M >M.saved &&\n \tgit update-index M &&\n-\ttest_expect_code 128 git pull . yellow &&\n+\ttest_expect_code 128 git pull --merge . yellow &&\n \ttest_cmp M M.saved &&\n \trm -f M.saved\n '\n@@ -229,7 +229,7 @@ test_expect_success 'interference with untracked working tree file' '\n \tgit tag -f anchor &&\n \tgit show-branch &&\n \techo >M this file should not matter &&\n-\tgit pull . master &&\n+\tgit pull --merge . master &&\n \ttest_path_is_file M &&\n \t! {\n \t\tgit ls-files -s |\ndiff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh\nindex 5e43997..5428f19 100755\n--- a/t/t6026-merge-attr.sh\n+++ b/t/t6026-merge-attr.sh\n@@ -172,7 +172,7 @@ test_expect_success 'up-to-date merge without common ancestor' '\n \ttest_tick &&\n \t(\n \t\tcd repo1 &&\n-\t\tgit pull ../repo2 master\n+\t\tgit pull --merge ../repo2 master\n \t)\n '\n \ndiff --git a/t/t6029-merge-subtree.sh b/t/t6029-merge-subtree.sh\nindex 73fc240..0e626d1 100755\n--- a/t/t6029-merge-subtree.sh\n+++ b/t/t6029-merge-subtree.sh\n@@ -69,7 +69,7 @@ test_expect_success 'merge update' '\n \tgit checkout -b master2 &&\n \tgit commit -m \"update git-gui\" &&\n \tcd ../git &&\n-\tgit pull -s subtree gui master2 &&\n+\tgit pull --merge -s subtree gui master2 &&\n \tgit ls-files -s >actual &&\n \t(\n \t\techo \"100644 $o3 0\tgit-gui/git-gui.sh\"\n@@ -98,7 +98,7 @@ test_expect_success 'initial ambiguous subtree' '\n test_expect_success 'merge using explicit' '\n \tcd ../git &&\n \tgit reset --hard master2 &&\n-\tgit pull -Xsubtree=git-gui gui master2 &&\n+\tgit pull --merge -Xsubtree=git-gui gui master2 &&\n \tgit ls-files -s >actual &&\n \t(\n \t\techo \"100644 $o3 0\tgit-gui/git-gui.sh\"\n@@ -111,7 +111,7 @@ test_expect_success 'merge using explicit' '\n test_expect_success 'merge2 using explicit' '\n \tcd ../git &&\n \tgit reset --hard master2 &&\n-\tgit pull -Xsubtree=git-gui2 gui master2 &&\n+\tgit pull --merge -Xsubtree=git-gui2 gui master2 &&\n \tgit ls-files -s >actual &&\n \t(\n \t\techo \"100644 $o1 0\tgit-gui/git-gui.sh\"\ndiff --git a/t/t6037-merge-ours-theirs.sh b/t/t6037-merge-ours-theirs.sh\nindex 3889eca..8e67d2a 100755\n--- a/t/t6037-merge-ours-theirs.sh\n+++ b/t/t6037-merge-ours-theirs.sh\n@@ -66,11 +66,11 @@ test_expect_success 'binary file with -Xours/-Xtheirs' '\n '\n \n test_expect_success 'pull passes -X to underlying merge' '\n-\tgit reset --hard master && git pull -s recursive -Xours . side &&\n-\tgit reset --hard master && git pull -s recursive -X ours . side &&\n-\tgit reset --hard master && git pull -s recursive -Xtheirs . side &&\n-\tgit reset --hard master && git pull -s recursive -X theirs . side &&\n-\tgit reset --hard master && test_must_fail git pull -s recursive -X bork . side\n+\tgit reset --hard master && git pull -m -s recursive -Xours . side &&\n+\tgit reset --hard master && git pull -m -s recursive -X ours . side &&\n+\tgit reset --hard master && git pull -m -s recursive -Xtheirs . side &&\n+\tgit reset --hard master && git pull -m -s recursive -X theirs . side &&\n+\tgit reset --hard master && test_must_fail git pull -m -s recursive -X bork . side\n '\n \n test_done\n-- \n1.9.2+fc1.19.g85b6256\n"},{"id":"240511","messageId":"20140502013753.GE75770@vauxhall.crustytoothpaste.net","threadId":"36565","inReplyTo":"1398988808-29678-5-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v6 4/7] pull: add --merge option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-05-02T01:37:53Z","receivedAt":"2014-05-02T01:37:53Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Thu, May 01, 2014 at 07:00:05PM -0500, Felipe Contreras wrote:\n> Also, deprecate --no-rebase since there's no need for it any more.\n> \n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  Documentation/git-pull.txt |  8 ++++++--\n>  git-pull.sh                | 10 +++++++++-\n>  2 files changed, 15 insertions(+), 3 deletions(-)\n> \n> diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\n> index 9a91b9f..767bca3 100644\n> --- a/Documentation/git-pull.txt\n> +++ b/Documentation/git-pull.txt\n> @@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you\n>  published that history already.  Do *not* use this option\n>  unless you have read linkgit:git-rebase[1] carefully.\n>  \n> ---no-rebase::\n> -\tOverride earlier --rebase.\n> +-m::\n> +--merge::\n> +\tForce a merge.\n> ++\n> +See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want\n> +to make `git pull` always use `--merge`.\n\nSo I'm confused here, and maybe you can enlighten me.  As I read this\ndocumentation, --merge would always force a merge, like --no-ff.  If so,\nI don't see an option to preserve the existing behavior, which is the\nI-don't-care-just-do-it case.  If the behavior is different, then this\ndocumentation needs to be improved, I think, along with the\ndocumentation earlier in the series.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"240512","messageId":"536305def1e35_23b2147b2f0bb@nysa.notmuch","threadId":"36565","inReplyTo":"20140502013753.GE75770@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH v6 4/7] pull: add --merge option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T02:41:34Z","receivedAt":"2014-05-02T02:41:34Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"brian m. carlson wrote:\n> On Thu, May 01, 2014 at 07:00:05PM -0500, Felipe Contreras wrote:\n> > Also, deprecate --no-rebase since there's no need for it any more.\n> > \n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> >  Documentation/git-pull.txt |  8 ++++++--\n> >  git-pull.sh                | 10 +++++++++-\n> >  2 files changed, 15 insertions(+), 3 deletions(-)\n> > \n> > diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\n> > index 9a91b9f..767bca3 100644\n> > --- a/Documentation/git-pull.txt\n> > +++ b/Documentation/git-pull.txt\n> > @@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you\n> >  published that history already.  Do *not* use this option\n> >  unless you have read linkgit:git-rebase[1] carefully.\n> >  \n> > ---no-rebase::\n> > -\tOverride earlier --rebase.\n> > +-m::\n> > +--merge::\n> > +\tForce a merge.\n> > ++\n> > +See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want\n> > +to make `git pull` always use `--merge`.\n> \n> So I'm confused here, and maybe you can enlighten me.  As I read this\n> documentation, --merge would always force a merge, like --no-ff.  If so,\n> I don't see an option to preserve the existing behavior, which is the\n> I-don't-care-just-do-it case.  If the behavior is different, then this\n> documentation needs to be improved, I think, along with the\n> documentation earlier in the series.\n\nI don't understand what is your point.\n\nSo basically you think these should be the same?\n\n  % git pull --merge --no-merge --rebase --no-rebase\n  % git pull\n\n-- \nFelipe Contreras\n"},{"id":"240525","messageId":"20140502141359.GE28634@odin.tremily.us","threadId":"36565","inReplyTo":"1398988808-29678-2-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v6 1/7] pull: rename pull.rebase to pull.mode","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2014-05-02T14:13:59Z","receivedAt":"2014-05-02T14:13:59Z","isPatch":true,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Thu, May 01, 2014 at 07:00:02PM -0500, Felipe Contreras wrote:\n> Also 'branch.<name>.rebase' to 'branch.<name>.pullmode'.\n\nPerhaps this has already been hashed out in a previous version of this\nseries, but we may want to use pull.update and branch.<name>.update to\nmatch the existing submodule.<name>.update.  Both settings are\nselecting the default integration style between HEAD and some other\nreference (pull's remote branch, the gitlinked commit, or the\nsubmodule's --remote branch).\n\nCheers,\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"240529","messageId":"20140502145755.GG28634@odin.tremily.us","threadId":"36565","inReplyTo":"1398988808-29678-6-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v6 5/7] pull: add merge-ff-only option","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2014-05-02T14:57:55Z","receivedAt":"2014-05-02T14:57:55Z","isPatch":true,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Thu, May 01, 2014 at 07:00:06PM -0500, Felipe Contreras wrote:\n> It is very typical for Git newcomers to inadvertently create merges and\n> worst; inadvertently pushing them. This is one of the reasons many\n> experienced users prefer to avoid 'git pull', and recommend newcomers to\n> avoid it as well.\n> \n> To avoid these problems and keep 'git pull' useful, it has been\n> suggested that 'git pull' barfs by default if the merge is\n> non-fast-forward, which unfortunately would break backwards\n> compatibility.\n> \n> This patch leaves everything in place to enable this new mode, but it\n> only gets enabled if the user specifically configures it; pull.mode =\n> merge-ff-only.\n\nThe subject and commit message also need “merge-ff-only” → “ff-only”.\n\nCheers,\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"240551","messageId":"20140502193250.GF75770@vauxhall.crustytoothpaste.net","threadId":"36565","inReplyTo":"536305def1e35_23b2147b2f0bb@nysa.notmuch","subject":"Re: [PATCH v6 4/7] pull: add --merge option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-05-02T19:32:50Z","receivedAt":"2014-05-02T19:32:50Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Thu, May 01, 2014 at 09:41:34PM -0500, Felipe Contreras wrote:\n> brian m. carlson wrote:\n> > On Thu, May 01, 2014 at 07:00:05PM -0500, Felipe Contreras wrote:\n> > > Also, deprecate --no-rebase since there's no need for it any more.\n> > > \n> > > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > > ---\n> > >  Documentation/git-pull.txt |  8 ++++++--\n> > >  git-pull.sh                | 10 +++++++++-\n> > >  2 files changed, 15 insertions(+), 3 deletions(-)\n> > > \n> > > diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt\n> > > index 9a91b9f..767bca3 100644\n> > > --- a/Documentation/git-pull.txt\n> > > +++ b/Documentation/git-pull.txt\n> > > @@ -127,8 +127,12 @@ It rewrites history, which does not bode well when you\n> > >  published that history already.  Do *not* use this option\n> > >  unless you have read linkgit:git-rebase[1] carefully.\n> > >  \n> > > ---no-rebase::\n> > > -\tOverride earlier --rebase.\n> > > +-m::\n> > > +--merge::\n> > > +\tForce a merge.\n> > > ++\n> > > +See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want\n> > > +to make `git pull` always use `--merge`.\n> > \n> > So I'm confused here, and maybe you can enlighten me.  As I read this\n> > documentation, --merge would always force a merge, like --no-ff.  If so,\n> > I don't see an option to preserve the existing behavior, which is the\n> > I-don't-care-just-do-it case.  If the behavior is different, then this\n> > documentation needs to be improved, I think, along with the\n> > documentation earlier in the series.\n> \n> I don't understand what is your point.\n> \n> So basically you think these should be the same?\n> \n>   % git pull --merge --no-merge --rebase --no-rebase\n>   % git pull\n\nMy point is that it's unclear to me what options I need to use to retain\nthe current behavior (fast-forward if possible, merge otherwise) without\na warning.  Right now, it looks like --merge is equivalent to --no-ff,\nwhich seems silly, since we already have an option for that.\n\nSo my request is that you add an option (command-line and configuration)\nthat maintains the current behavior, or if there's already such an\noption, that the documentation be clear enough so that I can figure it\nout.  Because right now, it's not.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"240558","messageId":"5363fcb47c77d_135215292ec3c@nysa.notmuch","threadId":"36565","inReplyTo":"20140502193250.GF75770@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH v6 4/7] pull: add --merge option","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T20:14:44Z","receivedAt":"2014-05-02T20:14:44Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"brian m. carlson wrote:\n> My point is that it's unclear to me what options I need to use to\n> retain the current behavior (fast-forward if possible, merge\n> otherwise) without a warning.\n\nThe current behavior is to always merge (ff or otherwise), just what\n`git merge` would do, so `git pull --merge`. I don't see what's\nconfusing about that.\n\n-- \nFelipe Contreras\n"},{"id":"240561","messageId":"20140502204424.GG75770@vauxhall.crustytoothpaste.net","threadId":"36565","inReplyTo":"5363fcb47c77d_135215292ec3c@nysa.notmuch","subject":"Re: [PATCH v6 4/7] pull: add --merge option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-05-02T20:44:24Z","receivedAt":"2014-05-02T20:44:24Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Fri, May 02, 2014 at 03:14:44PM -0500, Felipe Contreras wrote:\n> brian m. carlson wrote:\n> > My point is that it's unclear to me what options I need to use to\n> > retain the current behavior (fast-forward if possible, merge\n> > otherwise) without a warning.\n> \n> The current behavior is to always merge (ff or otherwise), just what\n> `git merge` would do, so `git pull --merge`. I don't see what's\n> confusing about that.\n\nWhen the documentation says \"Forces a merge\" without any clarifying\nstatement, that implies to me that it always creates a new commit.  I'm\ncertain that I'm not the only person who is going to think that.\n\nCould you please clarify the documentation for --merge and pull.mode to\navoid confusing users?\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"240564","messageId":"53640403.30600@bbn.com","threadId":"36565","inReplyTo":"1398988808-29678-2-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH v6 1/7] pull: rename pull.rebase to pull.mode","fromName":"Richard Hansen","fromEmail":"rhansen@bbn.com","sentAt":"2014-05-02T20:45:55Z","receivedAt":"2014-05-02T20:45:55Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2014-05-01 20:00, Felipe Contreras wrote:\n> Also 'branch.<name>.rebase' to 'branch.<name>.pullmode'.\n> \n> This way we can add more modes and the default can be something else,\n> namely it can be set to merge-ff-only, so eventually we can reject\n> non-fast-forward merges by default.\n> \n> The old configurations still work, but get deprecated.\n\ns/get/are/\n\n> \n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n>  Documentation/config.txt   | 39 ++++++++++++++++++++++-----------------\n>  Documentation/git-pull.txt |  2 +-\n>  branch.c                   |  4 ++--\n>  builtin/remote.c           | 14 ++++++++++++--\n>  git-pull.sh                | 31 +++++++++++++++++++++++++++++--\n>  t/t3200-branch.sh          | 40 ++++++++++++++++++++--------------------\n>  t/t5601-clone.sh           |  4 ++--\n>  7 files changed, 88 insertions(+), 46 deletions(-)\n> \n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index c26a7c8..c028aeb 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -708,7 +708,7 @@ branch.autosetupmerge::\n>  branch.autosetuprebase::\n>  \tWhen a new branch is created with 'git branch' or 'git checkout'\n>  \tthat tracks another branch, this variable tells Git to set\n> -\tup pull to rebase instead of merge (see \"branch.<name>.rebase\").\n> +\tup pull to rebase instead of merge (see \"branch.<name>.pullmode\").\n>  \tWhen `never`, rebase is never automatically set to true.\n>  \tWhen `local`, rebase is set to true for tracked branches of\n>  \tother local branches.\n\nShould branch.autosetuprebase be replaced with a new\nbranch.autosetupmode setting?\n\n> @@ -764,15 +764,17 @@ branch.<name>.mergeoptions::\n>  \toption values containing whitespace characters are currently not\n>  \tsupported.\n>  \n> -branch.<name>.rebase::\n> -\tWhen true, rebase the branch <name> on top of the fetched branch,\n> -\tinstead of merging the default branch from the default remote when\n> -\t\"git pull\" is run. See \"pull.rebase\" for doing this in a non\n> -\tbranch-specific manner.\n> +branch.<name>.pullmode::\n> +\tWhen \"git pull\" is run, this determines if it would either merge or\n> +\trebase the fetched branch.\n\nTo me this sentence implies that 'rebase' would rebase the fetched\nbranch onto HEAD, when it's actually the other way around.\n\n>                                  The possible values are 'merge',\n> +\t'rebase', and 'rebase-preserve'.\n\nWhile the name 'merge' is mostly self-explanatory, I think it needs\nfurther clarification:  Does 'merge' imply --no-ff?  Or --ff?  Or the\nvalue of merge.ff?  Which side will be the first parent?\n\nSimilarly, 'rebase' could use some clarification:\n  * the local branch is rebased onto the pulled branch, not the other\n    way around\n  * it doesn't simply do 'git rebase FETCH_HEAD' -- it also walks the\n    reflog of the upstream ref until it finds an ancestor of the local\n    branch\n\n>                                        See \"pull.mode\" for doing this in a\n> +\tnon branch-specific manner.\n\nI find this sentence to be a bit unclear and would prefer something\nlike:  \"Defaults to the value of pull.mode.\"\n\n>  +\n> -\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n> -\tso that locally committed merge commits will not be flattened\n> -\tby running 'git pull'.\n> +\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n> +\t'git rebase' so that locally committed merge commits will not be\n> +\tflattened by running 'git pull'.\n> ++\n> +\tIt was named 'branch.<name>.rebase' but that is deprecated now.\n\nTo me this sentence implies that .rebase was simply renamed to .pullmode\nwith no other changes.  I'd prefer something like this:\n\nbranch.<name>.rebase::\n    Deprecated in favor of branch.<name>.pullmode.\n\n(Same goes for pull.rebase.)\n\n>  +\n>  *NOTE*: this is a possibly dangerous operation; do *not* use\n>  it unless you understand the implications (see linkgit:git-rebase[1]\n> @@ -1881,15 +1883,18 @@ pretty.<name>::\n>  \tNote that an alias with the same name as a built-in format\n>  \twill be silently ignored.\n>  \n> -pull.rebase::\n> -\tWhen true, rebase branches on top of the fetched branch, instead\n> -\tof merging the default branch from the default remote when \"git\n> -\tpull\" is run. See \"branch.<name>.rebase\" for setting this on a\n> -\tper-branch basis.\n> +pull.mode::\n> +\tWhen \"git pull\" is run, this determines if it would either merge or\n> +\trebase the fetched branch. The possible values are 'merge',\n> +\t'rebase', and 'rebase-preserve'. See \"branch.<name>.pullmode\" for doing\n> +\tthis in a non branch-specific manner.\n> ++\n> +\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n> +\t'git rebase' so that locally committed merge commits will not be\n> +\tflattened by running 'git pull'.\n> ++\n>  +\n> -\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n> -\tso that locally committed merge commits will not be flattened\n> -\tby running 'git pull'.\n\nThe default value should be documented.  Also, rather than copy+paste\nthe description from branch.<name>.pullmode, I'd prefer a brief\nreference.  For example:\n\npull.mode::\n    See branch.<name>.pullmode.  Defaults to 'merge'.\n\n-Richard\n"},{"id":"240575","messageId":"53640a26569a5_135215292ec43@nysa.notmuch","threadId":"36565","inReplyTo":"53640403.30600@bbn.com","subject":"Re: [PATCH v6 1/7] pull: rename pull.rebase to pull.mode","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-05-02T21:12:06Z","receivedAt":"2014-05-02T21:12:06Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Richard Hansen wrote:\n> On 2014-05-01 20:00, Felipe Contreras wrote:\n> > Also 'branch.<name>.rebase' to 'branch.<name>.pullmode'.\n> > \n> > This way we can add more modes and the default can be something else,\n> > namely it can be set to merge-ff-only, so eventually we can reject\n> > non-fast-forward merges by default.\n> > \n> > The old configurations still work, but get deprecated.\n> \n> s/get/are/\n> \n> > \n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> >  Documentation/config.txt   | 39 ++++++++++++++++++++++-----------------\n> >  Documentation/git-pull.txt |  2 +-\n> >  branch.c                   |  4 ++--\n> >  builtin/remote.c           | 14 ++++++++++++--\n> >  git-pull.sh                | 31 +++++++++++++++++++++++++++++--\n> >  t/t3200-branch.sh          | 40 ++++++++++++++++++++--------------------\n> >  t/t5601-clone.sh           |  4 ++--\n> >  7 files changed, 88 insertions(+), 46 deletions(-)\n> > \n> > diff --git a/Documentation/config.txt b/Documentation/config.txt\n> > index c26a7c8..c028aeb 100644\n> > --- a/Documentation/config.txt\n> > +++ b/Documentation/config.txt\n> > @@ -708,7 +708,7 @@ branch.autosetupmerge::\n> >  branch.autosetuprebase::\n> >  \tWhen a new branch is created with 'git branch' or 'git checkout'\n> >  \tthat tracks another branch, this variable tells Git to set\n> > -\tup pull to rebase instead of merge (see \"branch.<name>.rebase\").\n> > +\tup pull to rebase instead of merge (see \"branch.<name>.pullmode\").\n> >  \tWhen `never`, rebase is never automatically set to true.\n> >  \tWhen `local`, rebase is set to true for tracked branches of\n> >  \tother local branches.\n> \n> Should branch.autosetuprebase be replaced with a new\n> branch.autosetupmode setting?\n\nMaybe. But if so, I think that should be done in another series.\nOtherwise we'll never have a chance to change anything.\n\n> > @@ -764,15 +764,17 @@ branch.<name>.mergeoptions::\n> >  \toption values containing whitespace characters are currently not\n> >  \tsupported.\n> >  \n> > -branch.<name>.rebase::\n> > -\tWhen true, rebase the branch <name> on top of the fetched branch,\n> > -\tinstead of merging the default branch from the default remote when\n> > -\t\"git pull\" is run. See \"pull.rebase\" for doing this in a non\n> > -\tbranch-specific manner.\n> > +branch.<name>.pullmode::\n> > +\tWhen \"git pull\" is run, this determines if it would either merge or\n> > +\trebase the fetched branch.\n> \n> To me this sentence implies that 'rebase' would rebase the fetched\n> branch onto HEAD, when it's actually the other way around.\n\nRight.\n\nThis actually interesting mode of thinking:\n\na) git pull --rebase\n\nWe want to rebase HEAD onto @{upstream}.\n\nb) git pull --merge\n\nWe want to merge HEAD into @{upstream}. (Why are we doing the opposite?)\n\nc) git pull --rebase github john\n\nWe weant to rebase github/john onto HEAD. (We are doing the opposite?)\n\nd) git pull --merge github john\n\nWe want to merge github/john into HEAD.\n\n> >                                  The possible values are 'merge',\n> > +\t'rebase', and 'rebase-preserve'.\n> \n> While the name 'merge' is mostly self-explanatory, I think it needs\n> further clarification:  Does 'merge' imply --no-ff?  Or --ff?  Or the\n> value of merge.ff?\n\n'pull.mode=merge' will do the same as `git merge`, I don't see where or\nhow it can be explained more clearly.\n\n> Which side will be the first parent?\n\nThe same as things currently are: the pulled branch into the current\nbranch (current branch is first parent).\n\nWe should probably change this, but that's out of scope of this series,\nand hasn't been decided yet.\n\n> >                                        See \"pull.mode\" for doing this in a\n> > +\tnon branch-specific manner.\n> \n> I find this sentence to be a bit unclear and would prefer something\n> like:  \"Defaults to the value of pull.mode.\"\n\nHmm, might make sense.\n\n> >  +\n> > -\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n> > -\tso that locally committed merge commits will not be flattened\n> > -\tby running 'git pull'.\n> > +\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n> > +\t'git rebase' so that locally committed merge commits will not be\n> > +\tflattened by running 'git pull'.\n> > ++\n> > +\tIt was named 'branch.<name>.rebase' but that is deprecated now.\n> \n> To me this sentence implies that .rebase was simply renamed to .pullmode\n> with no other changes.  I'd prefer something like this:\n> \n> branch.<name>.rebase::\n>     Deprecated in favor of branch.<name>.pullmode.\n> \n> (Same goes for pull.rebase.)\n\nRight.\n\n> >  +\n> >  *NOTE*: this is a possibly dangerous operation; do *not* use\n> >  it unless you understand the implications (see linkgit:git-rebase[1]\n> > @@ -1881,15 +1883,18 @@ pretty.<name>::\n> >  \tNote that an alias with the same name as a built-in format\n> >  \twill be silently ignored.\n> >  \n> > -pull.rebase::\n> > -\tWhen true, rebase branches on top of the fetched branch, instead\n> > -\tof merging the default branch from the default remote when \"git\n> > -\tpull\" is run. See \"branch.<name>.rebase\" for setting this on a\n> > -\tper-branch basis.\n> > +pull.mode::\n> > +\tWhen \"git pull\" is run, this determines if it would either merge or\n> > +\trebase the fetched branch. The possible values are 'merge',\n> > +\t'rebase', and 'rebase-preserve'. See \"branch.<name>.pullmode\" for doing\n> > +\tthis in a non branch-specific manner.\n> > ++\n> > +\tWhen 'rebase-preserve', also pass `--preserve-merges` along to\n> > +\t'git rebase' so that locally committed merge commits will not be\n> > +\tflattened by running 'git pull'.\n> > ++\n> >  +\n> > -\tWhen preserve, also pass `--preserve-merges` along to 'git rebase'\n> > -\tso that locally committed merge commits will not be flattened\n> > -\tby running 'git pull'.\n> \n> The default value should be documented.  Also, rather than copy+paste\n> the description from branch.<name>.pullmode, I'd prefer a brief\n> reference.  For example:\n> \n> pull.mode::\n>     See branch.<name>.pullmode.  Defaults to 'merge'.\n\nI'd say pull.mode is the important one.\n\n-- \nFelipe Contreras\n"},{"id":"240600","messageId":"53642F9D.3040606@bbn.com","threadId":"36565","inReplyTo":"53640a26569a5_135215292ec43@nysa.notmuch","subject":"Re: [PATCH v6 1/7] pull: rename pull.rebase to pull.mode","fromName":"Richard Hansen","fromEmail":"rhansen@bbn.com","sentAt":"2014-05-02T23:51:57Z","receivedAt":"2014-05-02T23:51:57Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2014-05-02 17:12, Felipe Contreras wrote:\n> Richard Hansen wrote:\n>> Should branch.autosetuprebase be replaced with a new\n>> branch.autosetupmode setting?\n> \n> Maybe. But if so, I think that should be done in another series.\n> Otherwise we'll never have a chance to change anything.\n\nSure.\n\n>>>                                  The possible values are 'merge',\n>>> +\t'rebase', and 'rebase-preserve'.\n>>\n>> While the name 'merge' is mostly self-explanatory, I think it needs\n>> further clarification:  Does 'merge' imply --no-ff?  Or --ff?  Or the\n>> value of merge.ff?\n> \n> 'pull.mode=merge' will do the same as `git merge`, I don't see where or\n> how it can be explained more clearly.\n\nHow about:\n\nbranch.<name>.pullmode::\n\tDetermines how 'git pull' integrates the fetched branch into\n\tbranch <name>.\n\tDefaults to the value of `pull.mode`.\n\tSupported values:\n+\n--\n\t`merge`:::\n\t\tMerge the fetched branch into <name>.\n\t\tSee also `merge.ff`.\n\t`rebase`:::\n\t\tFind the point at which <name> forked from the fetched\n\t\tbranch (see the `--fork-point` option of\n\t\tlinkgit:git-merge-base[1]), then rebase the commits\n\t\tbetween the fork point and branch <name> onto the\n\t\tfetched branch.\n\t`rebase-preserve`:::\n\t\tLike `rebase` but passes `--preserve-merges` to 'git\n\t\trebase'.\n--\n+\n*NOTE*: `rebase` and `rebase-preserve` are potentially dangerous; do\n*not* use them unless you understand the implications (see\nlinkgit:git-rebase[1] for details).\n\npull.mode::\n\tSee `branch.<name>.pullmode`.  Defaults to `merge`.\n\n> \n>> Which side will be the first parent?\n> \n> The same as things currently are: the pulled branch into the current\n> branch (current branch is first parent).\n\nThis was a rhetorical question -- I was trying to point out that the\ncurrent behavior should be documented.\n\n> \n> We should probably change this, but that's out of scope of this series,\n> and hasn't been decided yet.\n\nAgreed.  If this series is merged, a future series could add a\n'merge-there' pull mode.\n\n>> Also, rather than copy+paste\n>> the description from branch.<name>.pullmode, I'd prefer a brief\n>> reference.  For example:\n>>\n>> pull.mode::\n>>     See branch.<name>.pullmode.  Defaults to 'merge'.\n> \n> I'd say pull.mode is the important one.\n\nEither way works for me.  How about this:\n\nbranch.<name>.pullmode::\n\tOverrides the value of `pull.mode` for branch <name>.\n\npull.mode::\n\tDetermines how 'git pull' integrates the fetched branch into\n\tthe current branch.\n\tSupported values:\n+\n--\n\t`merge`:::\n\t\t(default)\n\t\tMerge the fetched branch into the current branch.\n\t\tSee also `merge.ff`.\n\t`rebase`:::\n\t\tFind the point at which the current branch forked from\n\t\tthe fetched branch (see the `--fork-point` option of\n\t\tlinkgit:git-merge-base[1]), then rebase the commits\n\t\tbetween the fork point and the current branch onto the\n\t\tfetched branch.\n\t`rebase-preserve`:::\n\t\tLike `rebase` but passes `--preserve-merges` to 'git\n\t\trebase'.\n--\n+\n*NOTE*: `rebase` and `rebase-preserve` are potentially dangerous; do\n*not* use them unless you understand the implications (see\nlinkgit:git-rebase[1] for details).\n\n-Richard\n"}]}