Subject: Re: [PATCH] pull: require choice between rebase/merge on non-fast-forward pull

From: John Keeping <[email-masked]>
Date: Tue, 2 Jul 2013 22:18:20 +0100

On Fri, Jun 28, 2013 at 03:41:34PM -0700, Junio C Hamano wrote:
> John Keeping <[email-masked]> writes:
> 
> >> Here, "git pull . branch1" is merely saying "I want to integrate
> >> the work on my current branch with that of branch1" without saying
> >> how that integration wants to happen.
> >
> > The change that I think is important is that the "bring my branch
> > up-to-date" operation should force the user to choose what to do if the
> > branch does not fast-forward to its upstream.  If that was spelled "git
> > update" then having "git pull" perform a merge would be fine, but we
> > spell this operation as "git pull" so the change needs to happen there.
> 
> I am not sure I quite get what you want to say with "git update",
> and I am not sure if I necessarily want to know---I do not think we
> would want to add yet another command that DWIMs for certain _I_,
> that may not match newbie expectations.

I wasn't proposing any new command, I was trying to express the
operation that users coming from non-distributed VCSs want to perform
(which is called "update" in svn).  The problem is that a DVCS operates
in a completely different way and a lot of users do not seem to want to
learn the difference but simply try to map the existing commands that
they know onto Git commands ([1] is the top result for "svn commands to
git" on Google and maps "svn update" straight to "git pull").

[1] http://git.or.cz/course/svn.html

> > I don't think "git pull remote branch" falls into the same category as
> > plain "git pull" so I'm not convinced that defaulting to merge there is
> > unreasonable.  The original message about this [1] did talk about only
> > "git pull" with no arguments.
> 
> If you want to limit the scope to only "git pull" (without any
> command line argument), I actually do not have strong preference for
> or against it either way.  Perhaps a follow-up patch to be squashed?

I remember looking at this a few weeks ago and being concerned that it's
impossible to tell what options you actually have in git-pull because it
just invokes 'git fetch "$@"' and git-pull(1) does advertise a number of
fetch options.  It may be that "test $# = 0" is good enough, but ideally
I want to test for non-option arguments.

I can't see a way of doing this without putting knowledge of all of the
fetch options in git-pull so that we can handle options with arguments
correctly.