git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mirror clone does not keep HEAD updated
@ 2023-04-04 16:16 Daniel Martí
  2023-04-04 16:38 ` Junio C Hamano
  2023-04-05  1:38 ` Felipe Contreras
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Martí @ 2023-04-04 16:16 UTC (permalink / raw)
  To: git

Hello all,

I'm testing `git clone --mirror` to properly mirror a repository on
github.com. It appears to be working well, except for keeping HEAD
correctly in place.

For example, here is what I did:

	$ git clone --mirror https://github.com/mvdan/test-repo
	$ cd test-repo
	$ git branch -a
	* main
	$ git log HEAD
	commit d1adda533e90692e02ae837233368fbcca2a0e49 (HEAD -> main)
	[...]

If I then go on the GitHub web UI to rename the default branch from
"main" to "newmain", `git remote update --prune` sees that:

	$ git remote update --prune
	From https://github.com/mvdan/test-repo
	 - [deleted]         (none)     -> main
	 * [new branch]      newmain   -> newmain

However, HEAD stops working:

	$ git log HEAD
	fatal: your current branch 'main' does not have any commits yet

Am I holding the mirror wrong somehow? As far as the manpages say, `git
remote update` should be enough to fully mirror all refs.
And my understanding is that using HEAD is correct, that I do not need
to use origin/HEAD like in a regular git clone.

I also tried what I would usually do to sync origin/HEAD in a regular
git clone, but unsurprisingly, that does not work:

	$ git remote set-head origin -a
	error: Not a valid ref: refs/remotes/origin/newmain

Any pointers appreciated. Assuming I'm not missing anything obvious
here, this might be a bug in `git remote udpate` for mirror clones.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-05  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-04 16:16 mirror clone does not keep HEAD updated Daniel Martí
2023-04-04 16:38 ` Junio C Hamano
2023-04-05  1:56   ` Felipe Contreras
2023-04-05  1:38 ` Felipe Contreras

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 NNTP newsgroup(s).