git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Øystein Walle" <oystwa@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, rn+git@sigpipe.cz
Subject: Re: [PATCH v2] clone: Allow combining --bare and --origin
Date: Wed,  4 Aug 2021 15:30:10 +0200	[thread overview]
Message-ID: <20210804133010.25855-1-oystwa@gmail.com> (raw)
In-Reply-To: <xmqqv94mtdyj.fsf@gitster.g>

Hi again,

Thanks for accepting the patch.

> It is somewhat unfortunate that we do not say what the name of the
> "origin" is anywhere in the resulting configuration file.  The only
> way to tell that "--origin somewhere" was used is to notice that there
> is only one remote and its name is "somewhere".

This reads as self-contradictory to me. The word "origin" is nowhere in
the configuration file, that's true. But that's because the user chose
it to be that way, and the name the user chose is in the there.

The reason I see it as self-contradictory is that I see two different
usages of the word "origin" in your email:

 1. A *term* meaning the repository that was cloned (e.g. 'name of the
 "origin"', remote.originName)

 2. The *name* of a remote ('there is only one remote and its name is
 [not "origin"]')

Seems you are aware since you write it in quotes :-) 

Both usages appear in the wild and are even mixed sometimes, but in my
experience it's not a big deal; it's usually obvious from context. I
think the second usage is the common one, but the name is so common that
it leads to the first. Is this something we'd like to tackle? If so, it
just occured to me that it certainly doesn't help that the switch to
change the name referring to the repo that was cloned from "origin" to
something else is "--origin".

> I do not think "git fetch" in such a repository knows that it needs to
> fetch from 'somewhere', even whe it is the only remote repository
> available to us.

Changing git fetch to fall back to a remote not named "origin" if that
is the only one configured makes perfect sense to me. (I am skeptical
about remotes.originName since that favors the first usage outlined
above.)

I have cc'ed the origin (pun overtly intended) of this patch and
discussion for their take on it.

> Instead of "usually the thing is called 'origin', so let's make sure
> it does not exist", we may want to say "there is only one remote and
> it is called somewhere because that is how we named it", i.e.
>
>	git -C clone-bare config --name-only \ --get-regexp
>	"remote\..*\.url" >actual && echo remote.somewhere.url >expect
>	&& test_cmp actual expect

This seems like like a better test than the one I wrote.

By the way, I noticed you already fixed my mistake with the repo name.
Thanks for that. I sent this as a v2, but as you can imagine I did it in
two steps in real life. First I removed the test then later I wrote a
new one, and in between I rebased my changes. In the mean time new tests
were added. I noticed they failed, but I didn't realize that was my
fault.

Øsse

  reply	other threads:[~2021-08-04 13:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-01  8:25 [PATCH] clone: Remove constraint on --bare and --origin Øystein Walle
2021-08-02  2:18 ` Junio C Hamano
2021-08-02  8:53 ` Ævar Arnfjörð Bjarmason
2021-08-02 17:49   ` [PATCH v2] clone: Allow combining " Øystein Walle
2021-08-03 21:28     ` Junio C Hamano
2021-08-04 13:30       ` Øystein Walle [this message]
2021-08-04 17:06         ` Junio C Hamano
2021-08-06 20:23           ` Roman Neuhauser
2021-08-06 22:13             ` Junio C Hamano
2021-08-07 11:18               ` Roman Neuhauser
2021-08-07 22:08           ` Re* " Junio C Hamano
2021-08-08  2:03             ` Roman Neuhauser
2021-08-04  1:16     ` Junio C Hamano

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=20210804133010.25855-1-oystwa@gmail.com \
    --to=oystwa@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rn+git@sigpipe.cz \
    /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).