git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah"

From
Paolo Bonzini <bonzini@gnu.org>
Date
Apr 24, 2008, 06:23 UTC
Message-ID
<4810275B.70404@gnu.org>
In-Reply-To
<7vtzhsqlfi.fsf@gitster.siamese.dyndns.org>
> Ooo.  But I think that's the other way around.  It was prepared for that
> purpose but people never followed through.  Check the archive around
> commit 3894439 (Teach "git remote" a mirror mode, 2007-09-02).

Well, the thread is not very explicative. Neither is the commit log message. There is no info as to *why* it is useful.

After finding no particularly good info in the commit, and seeing that the functionality is unused within git's shell script porcelain, I wrote my RFC on the intuition that it is a failed experiment. (The rest of this message is also assuming this possibly wrong intuition).

>> --mirror" is close to useless: anyone who needs it 99% of the time
>> knows how to hack the config...
> 
> Eh, in that sense, "git remote" itself is useless, isn't it?

Hm, bad sentence on my side. My point was that my proposed improvements to clone:

   git clone --bare -o origin <url> foo.git

satisfy 99% of the usecase; you usually know beforehand if you're cloning for local development or for mirrors. Anyone who *still* needs --mirror after that (i.e. needs two mirror-mode remotes, or needs it on non-bare repositories), 99% of the time knows how to hack the config. Actually in the latter case (non-bare repos) he might have to hack the config soon, if Dscho's patch to forbid this is polished and goes in.

In the end, this piece of functionality is almost unused (surely unused within git's shell porcelain, if not in the wild) and is dubiously placed for two reasons:

1) If the point of git remote is to shield from the config, what the 
user will learn is that "git remote" is about "git branch -r" (maybe 
he'll also learn "refs/remotes/something").  Now instead you have an 
option that goes under "git remote" just because it creates remote.* 
configuration options.  Indeed, "git remote add --mirror -f" will create 
*local* branches, so that "git branch -r" does not show them.
2) Similarly, "--mirror" suggests that the remote will go hand in hand 
with "git push" (that has the "--mirror" option, and this started my 
confusion) rather than "git fetch"/"git pull".  Indeed, even after my 
patch[1] to add some DWIM functionality for mirrors to "git push", the 
user will need to hack the config file manually to activate the DWIM.

Instead, my proposed meaning of "git remote add --mirror" would fix both discrepancies...

Paolo
[1] http://marc.info/?l=git&m=120877130932254&w=2
Previous: Johannes Schindelin
Message 9 of 9 in “[RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah"”
  1. Paolo BonziniApr 23, 2008
  2. Johannes SchindelinApr 23, 2008
  3. Junio C HamanoApr 23, 2008
  4. Daniel BarkalowApr 23, 2008
  5. Jeff KingApr 23, 2008
  6. Paolo BonziniApr 23, 2008
  7. Junio C HamanoApr 23, 2008
  8. Johannes SchindelinApr 23, 2008
  9. Paolo BonziniApr 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.