git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH 1/3] fetch: add --allow-local option
Date: Thu, 16 May 2013 08:58:54 -0700	[thread overview]
Message-ID: <7v61yi9arl.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1368689474-28911-2-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Thu, 16 May 2013 02:31:12 -0500")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> So that it becomes possible to override the behavior when the remote
> tracked is '.'; if it is, we default back to 'origin'.

I know I was the stupid one who originally suggested this, but I
think this is a wrong direction to go.  I do not think it solves
your "I do not want to say 'git fetch origin'" problem.

You do "git checkout -t -b mywork master" because you want to later
be able to conveniently rebase mywork on top of your local master
(i.e. make @{u} notation work for you) [*1*].

What "git checkout -t -b $branch $up" does is to declare that branch
builds on top of $up, which often is some remote tracking branch.
And "git pull [--rebase]" on that $branch is to

    (1) make sure $up is available and up to date; and

    (2) integrate with $up.  The first step is "git fetch" and it
        has to go to the repository $up comes from.

If $up is in your local repository (the original "fork mywork from
master in my repository"), the first step ought to be a no-op, and
"git fetch" from the current repository may seem wasteful, but I
think we already have an optimization to make this no-op not to
transfer anything network-wise.  There is no justification for it to
go to 'origin' or any other random remote that is different from the
reopsitory $up comes from.

I _think_ the real reason you want a "git fetch" while on "mywork"
to go to 'origin' is because you are building your "master" off of
somebody else's work that comes from 'origin', and you want to check
what has changed to see what you need to rebuild both your "master"
and "mywork" branches on top of.  If 'master' were forked from a
remote that is not 'origin', then making "git fetch" ignore '.' and
instead go to 'origin' would not solve anything.  For an updated
behaviour to be useful in that workflow, it needs to follow the
inter-branch relationship ("mywork is a fork of master which is a
fork of frotz branch from a remote xyzzy") to see the first remote
repository and fetch from there, instead of blindly fetching from
the 'origin'.

Having said all that, I am not all that sure that it is a good idea
to introduce such an exception for "git fetch" to ignore '.',
regardless of where it goes instead, either the 'origin' or the
first remote repository it finds by recursively finding its
upstreams, to break the consistency at the UI level.  It is dubious
if the benefit of convenience to fetch from remote 'xyzzy' that is
an eventual remote of 'mywork' without having to say so outweighs
the cost of additional UI inconsistency, making things harder to
explain to both new and old people.


[Footnote]

*1* Another side effect this has is that in a triangular workflow,
    the place you push to may not be the place the branch you
    integrate with (i.e. 'master') lives (i.e. '.', your local
    repository), and the name you want to push it as may not be the
    same as the branch you integrate with (i.e. 'master'), either.

    Ram's branch.mywork.pushremote can solve the former (i.e. where
    it goes), but not the latter (i.e. to which branch it is pushed),
    and that is a valid issue that may need to be addressed.

  parent reply	other threads:[~2013-05-16 15:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  7:31 [PATCH 0/3] fetch: fix '.' fetching Felipe Contreras
2013-05-16  7:31 ` [PATCH 1/3] fetch: add --allow-local option Felipe Contreras
2013-05-16  8:25   ` Ramkumar Ramachandra
2013-05-16  8:53     ` Felipe Contreras
2013-05-16  9:27       ` Ramkumar Ramachandra
2013-05-16  9:34         ` Felipe Contreras
2013-05-16  9:58           ` Ramkumar Ramachandra
2013-05-16 10:27             ` Felipe Contreras
2013-05-16 10:32               ` Ramkumar Ramachandra
2013-05-16 12:54                 ` Felipe Contreras
2013-05-16 15:58   ` Junio C Hamano [this message]
2013-05-16 16:26     ` Felipe Contreras
2013-05-16 16:38       ` Junio C Hamano
2013-05-16 16:52         ` Felipe Contreras
2013-05-16 18:04           ` Junio C Hamano
2013-05-16 23:07             ` Felipe Contreras
2013-05-16 23:24               ` Junio C Hamano
2013-05-17  0:04                 ` Felipe Contreras
2013-05-17 18:30                   ` Junio C Hamano
2013-05-18 12:25                     ` Felipe Contreras
2013-05-19  5:51                       ` Junio C Hamano
2013-05-19  6:10                         ` Felipe Contreras
2013-05-19  7:56                         ` About overzealous compatibility Felipe Contreras
2013-05-19 14:27                           ` Felipe Contreras
2013-05-18 13:12                     ` [PATCH 1/3] fetch: add --allow-local option Philip Oakley
2013-05-18 14:23                       ` Felipe Contreras
2013-05-18 20:53                         ` Philip Oakley
2013-05-18 22:26                           ` Felipe Contreras
2013-05-19  6:10                       ` Junio C Hamano
2013-05-16  7:31 ` [PATCH 2/3] fetch: switch allow-local off by default Felipe Contreras
2013-05-16  7:31 ` [PATCH 3/3] remote: disable allow-local for pushes 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=7v61yi9arl.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    /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).