git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Andreas Krey <a.krey@gmx.de>, John Keeping <john@keeping.me.uk>,
	Jeff King <peff@peff.net>, Richard Hansen <rhansen@bbn.com>,
	Philip Oakley <philipoakley@iee.org>,
	"Brian M. Carlson" <sandals@crustytoothpaste.net>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH v4 0/7] Reject non-ff pulls by default
Date: Sat, 12 Oct 2013 02:01:56 -0500	[thread overview]
Message-ID: <1381561322-20059-2-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1381561322-20059-1-git-send-email-felipe.contreras@gmail.com>

Minor changes since v3.

Junio already sent a similar patch, but I think this is simpler.

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 suggested
that 'git pull' barfs by default if the merge is non-fast-forward, which
unfortunately would break backwards compatibility.

This patch series leaves everything in place to enable this new mode, but it
only gets enabled if the user specifically configures it; pull.mode =
merge-ff-only.

Later on this mode can be enabled by default (e.g. in v2.0).

To achieve that first some configurations are renamed: for example: pull.rebase
=> pull.mode = rebase, but the old ones remain functional, thus there are no
functional changes.

Then the new mode 'merge-ff-only' is added, but not enabled by default, and
finally, a warning is added so the users will know what to do when the new
mode is indeed enabled by default.

Diff from last version:

--- a/git-pull.sh
+++ b/git-pull.sh
@@ -293,12 +293,13 @@ case "$merge_head" in
        then
                case "$mode" in
                merge-ff-only)
-                       die "The pull was not fast-forward, please either merge or rebase."
+                       die "$(gettext "The pull was not fast-forward, please either merge or rebase.
+If unsure, run 'git pull --merge'.")"
                        ;;
                default)
-                       say "The pull was not fast-forward, in the future you would have to choose
+                       echo "$(gettext "warning: the pull was not fast-forward, in the future you would have to choose
 a merge or a rebase, falling back to old style for now (git pull --merge).
-Read 'git pull --help' for more information."
+Read 'git pull --help' for more information.")" >&2
                        ;;
                esac
        fi

Felipe Contreras (7):
  pull: rename pull.rename to pull.mode
  pull: refactor $rebase variable into $mode
  pull: add --merge option
  pull: add merge-ff-only option
  pull: add warning on non-ff merges
  pull: cleanup documentation
  pull: add documentation about non-ff merges

 Documentation/config.txt   | 24 +++++++++--------
 Documentation/git-pull.txt | 32 +++++++++++++++++++----
 branch.c                   |  4 +--
 git-pull.sh                | 64 +++++++++++++++++++++++++++++++++++++---------
 t/t3200-branch.sh          | 40 ++++++++++++++---------------
 t/t5520-pull.sh            | 62 ++++++++++++++++++++++++++++++++++++++++++++
 t/t5601-clone.sh           |  4 +--
 7 files changed, 178 insertions(+), 52 deletions(-)

-- 
1.8.4-fc

  reply	other threads:[~2013-10-12  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12  7:01 [PATCH v4 4/7] pull: add merge-ff-only option Felipe Contreras
2013-10-12  7:01 ` Felipe Contreras [this message]
2013-10-12  7:01 ` [PATCH v4 3/7] pull: add --merge option Felipe Contreras
2013-10-12  7:01 ` [PATCH v4 5/7] pull: add warning on non-ff merges Felipe Contreras
2013-10-12  7:01 ` [PATCH v4 6/7] pull: cleanup documentation Felipe Contreras
2013-10-12  7:02 ` [PATCH v4 2/7] pull: refactor $rebase variable into $mode Felipe Contreras
2013-10-12  7:02 ` [PATCH v4 1/7] pull: rename pull.rename to pull.mode Felipe Contreras
2013-10-12  7:02 ` [PATCH v4 7/7] pull: add documentation about non-ff merges Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381561322-20059-2-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=a.krey@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=john@keeping.me.uk \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    --cc=rhansen@bbn.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).