"Philip Oakley" <philipoak...@iee.org> writes:

> From: "Junio C Hamano" <gits...@pobox.com>
> Sent: Monday, May 20, 2013 11:22 PM
>> "Philip Oakley" <philipoak...@iee.org> writes:
>>> So we can have a branch whose remote is '.'
>>> _and_ a remote whose URL is '.'
>> Yes, and they are two separate concepts.
> Thank you of the confirmation.
>> "git fetch" while on "mywork" branch with this:
>>    [branch "mywork"]
>>        remote = git://git.k.org/pub/scm/git/git.git
>>        merge = refs/heads/master
>> without having any named remote whose remote.$name.url is set to
>> that URL may happen to work but it is by accident as far as I know.
> Interesting. Any thoughts on which way it should be
> documented/deprecated?

If "leave it as-is" is not an option, I personally would prefer
mentioning "this happens to work, but do not rely on it" in the
passing.  I do not see any immediate need to break things for people
discovered that this happens to work and who decided that they have
no need for a remote tracking branch for the particular remote this
branch happens to integrate with.  By making that choice, they may
be forgoing the use of @{u}, but they won't be inconvenienced as
"git fetch" will leave what they need @{u} for in FETCH_HEAD, i.e.
instead of doing

        git fetch
        git log [-p] ..@{u}
        git merge @{u} ;# or git rebase @{u}

as a "verify in the middle" replacement for "git pull [--rebase]",
they can do

        git fetch
        git log [-p] ..FETCH_HEAD
        git merge FETCH_HEAD ;# or git rebase FETCH_HEAD

just fine.

The "do not rely on it" is primarily because there are more familiar
ways invented later (namely, use a named remote instead of writing a
real URL, with remote tracking branches).  I do not think we would
want to deliberately sabotage the people who currently use such a
setting, but I do not see a strong reason to recommend it to people
who are new to Git, either, *unless* they need to fetch from many
different places and do not want to have remote tracking branches
because the only time they care about the state of their remotes is
immediately after they fetched.

>>> Can there be a clash with a named remote that is actually '.', where
>>> the push/fetch is actually a no-op?
>> Nobody sane would do it in the first place, so...
> Oh I don't know. I don't think 'sanity' comes into it any more than
> common sense' is common. It's easy to fall into the inverse
> Kruger-Dunning mode where those in the know don't realise how much
> they know, and how 'stupid' those that don't can be (that'd be me;-).

How would you even express such a remote named "." in the first
place?  "git remote add" would not let you say:

        $ git remote add . git://some.where.xz/some/repo.git
        fatal: '.' is not a valid remote name

and even if you add configuration variables by hand, it would not
look like this:

        [remote "."]
                fetch = +refs/heads/*:refs/remotes/./*

You would want some real token between "refs/remotes/" and the
trailing "/*" instead, so...

> All this 'what's a dot-repo and where can I use it' came about because
> of an answer that give it's use as a 'trick'.
> On Sat, May 4, 2013 at 2:51 PM, Jonathan Nieder <jrnie...@gmail.com>
> wrote:
>> Another trick is to use "git push":
>>         git push . $production_sha1:refs/heads/master

It all falls out naturally from the "Git is distributed and no
repository is special" principle.  I think that word "trick" merely
refers to "those who do not realize that the local repository is not
all that special and merely is _a_ repository just like anybody
else's may not realize they can do this", nothing more.

> Filipe gave 'git fetch .' in [PATCH 1/3] fetch: add --allow-local
> option, 16 May 2013

That patch came from a mistaken suggestion from me that was
retracted with

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to