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

Re: [PATCH] Added --mirror-all to git-fetch.

From
Shawn Pearce <spearce@spearce.org>
Date
Sep 20, 2006, 17:31 UTC
Message-ID
<20060920173126.GG23260@spearce.org>
In-Reply-To
<7vac4uihr3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 8 quoted lines
> Shawn Pearce <spearce@spearce.org> writes:
> > Originally I gave Pasky a one-liner on #git:
> >
> >   git fetch --force origin $(git ls-remote origin \
> >       | awk '{if(!/\^{}$/){print $2":"$2}}')
> 
> Which sounds a very sane thing to do, especially given git is
> designed to be scripted this way.
Exactly.  So I'm not sure why he was against it.  After all he must
have some script that's looping over all mirrored repositories and
invoking git fetch in them.  :-)
 
Show 5 quoted lines
> > 	- it has a single remote named origin;
> 
> Do you mean ".git/remotes must have only one file 'origin' and
> nothing else", or do you mean "There must be .git/remotes/foobla
> for 'git-mirror foobla' to work"?

I meant ".git/remotes must have only one file 'origin' and nothing else". Because what does it mean to mirror two different repositories at the same time into the same ref namespace? The most recently fetched would always win.

But now that I'm writing this I can see someone wanting multiple
remotes so they could store different URLs for the same repository
and call fetch on another if the first isn't responding.  So I
retract this entirely.  So there doesn't even need to be remotes
file; the URL could just be passed on the command line.  A remotes
file (like the default "origin" one) is just a handy place to store
the URL.
 
Show 6 quoted lines
> > 	- HEAD isn't a symlink or a symref (its a normal ref in its
> > 	  own right);
> 
> Why?  Usually HEAD is a pointer to the active branch.  I
> consider it is a bug in the upload-pack protocol not to convey
> that information (but that is a separate topic).

Because we don't want to update HEAD with the SHA1 that's on the remote if that's actually going to update some other ref which doesn't have the same value. :-)

I think its simple enough to verify HEAD isn't a symlink or symref (or just doesn't exist) early in the mirror script. If the user really wants to do a mirror and they just did a `git init-db --bare` they could also do a `rm HEAD` before starting `git-mirror`.

But I agree with you entirely about HEAD being a SHA1 and not its actual link target in the network protocol. An annoying bug.

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 14 in “Added --mirror-all to git-fetch.”
  1. Added --mirror-all to git-fetch.Shawn Pearce, Sep 19, 2006
  2. Petr BaudisSep 19, 2006
  3. Junio C HamanoSep 20, 2006
  4. Petr BaudisSep 20, 2006
  5. Shawn PearceSep 20, 2006
  6. Junio C HamanoSep 20, 2006
  7. Shawn PearceSep 20, 2006
  8. Junio C HamanoSep 20, 2006
  9. Shawn PearceSep 20, 2006
  10. Junio C HamanoSep 20, 2006
  11. A Large Angry SCMSep 20, 2006
  12. Petr BaudisSep 20, 2006
  13. Junio C HamanoSep 20, 2006
  14. Shawn PearceSep 20, 2006

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.