git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/6] Reject non-ff pulls by default
@ 2014-04-29 11:17 Felipe Contreras
  2014-04-29 11:17 ` [PATCH v5 1/6] pull: rename pull.rename to pull.mode Felipe Contreras
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Felipe Contreras @ 2014-04-29 11:17 UTC (permalink / raw)
  To: git
  Cc: Andreas Krey, John Keeping, Jeff King, Richard Hansen,
	Philip Oakley, Brian M. Carlson, Felipe Contreras

It is very typical for Git newcomers to inadvertently create merges and worst:
inadvertently pushing them. This is one of the reasons many experienced users
prefer to avoid 'git pull', and recommend newcomers to avoid it as well.

To avoid these problems and keep 'git pull' useful, it has been agreed that
'git pull' should barf by default if the merge is non-fast-forward.
Unfortunately this breaks backwards-compatibility, so we need to be careful
about the error messages we give, and that we provide enough information to our
users to move forward without distrupting their workflow too much.

With the proper error messages and documentation, it has been agreed that the
new behavior is OK.

These are the steps needed to achieve this:

4) Only allow fast-forward merges by default

We could pass --ff-only to `git merge`, however, if we do that we'll get an error like this:

  Not possible to fast-forward, aborting.

This is not friendly; we want an error that is user-friendly:

  The pull was not fast-forward, please either merge or rebase.
  If unsure, run 'git pull --merge'.

When we do this we want to give the users the option to go back to the previous
behavior, so a new configuration is needed.

3) Add merge-ff-only config

This option would trigger a check inside `git pull` itself, and error out with
the aforementioned message if it's not possible to do a fast-forward merge.

However, this option conflicts with --rebase, and --no-rebase. Solution below.

2) Add --merge option

Since we have a message that says "If unsure, run 'git pull --merge'", which is
more friendly than 'git pull --no-rebase', we should add this option, and
deprecate --no-rebase.

However, the documentation would become confusing if --merge is configured in
pull.rebase, instead, we want something like this:

  See `pull.mode`, `branch.<name>.pullmode` in linkgit:git-config[1] if you want
  to make `git pull` always use `--merge`.

1) Rename pull.rename to pull.mode and
   branch.<name>.rebase to branch.<name>.pullmode

This way the configurations and options remain consistent:

  git pull --merge
  pull.mode = merge
  branch.<name>.pullmode = merge

  git pull --rebase
  pull.mode = rebase
  branch.<name>.pullmode = rebase

  git pull --rebase=preserve
  pull.mode = rebase-preserve
  branch.<name>.pullmode = rebase-preserve

  git pull
  pull.mode = merge-ff-only
  branch.<name>.pullmode = merge-ff-only
 
This patch series does all the steps mentioned, but in reverse order, and in
addition updates the tests to use the new configurations instead.


Felipe Contreras (6):
  pull: rename pull.rename to pull.mode
  pull: migrate all the tests to pull.mode
  pull: refactor $rebase variable into $mode
  pull: add --merge option
  pull: add merge-ff-only option
  pull: only allow ff merges by default

 Documentation/config.txt     |  37 ++++++++-------
 Documentation/git-pull.txt   |  28 ++++++++++--
 branch.c                     |   4 +-
 builtin/remote.c             |  14 +++++-
 git-pull.sh                  | 105 ++++++++++++++++++++++++++++++++-----------
 t/t3200-branch.sh            |  40 ++++++++---------
 t/t4013-diff-various.sh      |   2 +-
 t/t5500-fetch-pack.sh        |   2 +-
 t/t5505-remote.sh            |   2 +-
 t/t5520-pull.sh              |  90 ++++++++++++++++++++++++-------------
 t/t5524-pull-msg.sh          |   2 +-
 t/t5601-clone.sh             |   4 +-
 t/t5700-clone-reference.sh   |   4 +-
 t/t6022-merge-rename.sh      |  20 ++++-----
 t/t6026-merge-attr.sh        |   2 +-
 t/t6029-merge-subtree.sh     |   6 +--
 t/t6037-merge-ours-theirs.sh |  10 ++---
 17 files changed, 245 insertions(+), 127 deletions(-)

-- 
1.9.2+fc1.3.gade8541

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-04-30 20:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29 11:17 [PATCH v5 0/6] Reject non-ff pulls by default Felipe Contreras
2014-04-29 11:17 ` [PATCH v5 1/6] pull: rename pull.rename to pull.mode Felipe Contreras
2014-04-29 12:24   ` Marat Radchenko
2014-04-29 13:32     ` Felipe Contreras
2014-04-29 21:54   ` Philip Oakley
2014-04-29 22:05     ` Felipe Contreras
2014-04-29 23:00       ` Philip Oakley
2014-04-30 20:26   ` Richard Hansen
2014-04-29 11:17 ` [PATCH v5 2/6] pull: migrate all the tests " Felipe Contreras
2014-04-29 11:17 ` [PATCH v5 3/6] pull: refactor $rebase variable into $mode Felipe Contreras
2014-04-29 11:17 ` [PATCH v5 4/6] pull: add --merge option Felipe Contreras
2014-04-29 11:17 ` [PATCH v5 5/6] pull: add merge-ff-only option Felipe Contreras
2014-04-29 11:17 ` [PATCH v5 6/6] pull: only allow ff merges by default Felipe Contreras
2014-04-30 17:55 ` [PATCH v5 0/6] Reject non-ff pulls " Junio C Hamano
2014-04-30 18:44   ` Felipe Contreras
2014-04-30 19:16     ` Junio C Hamano
2014-04-30 19:22       ` Felipe Contreras
2014-04-30 19:52         ` Junio C Hamano
2014-04-30 19:28     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).