From: Felipe Contreras <felipe.contreras@gmail.com>
To: "Daniel Martí" <mvdan@mvdan.cc>
Cc: git@vger.kernel.org
Subject: Re: mirror clone does not keep HEAD updated
Date: Tue, 4 Apr 2023 20:38:33 -0500 [thread overview]
Message-ID: <CAMP44s1TBUmc6mhGSWQ1v+E5_VRqnCUXURHs2cM-vE22eyndsQ@mail.gmail.com> (raw)
In-Reply-To: <harpgnimhcdp2m6hww7ht7pgxvchllvrncnwoxkivaorb5xhm7@5rcr2p7hcp4x>
On Tue, Apr 4, 2023 at 11:35 AM Daniel Martí <mvdan@mvdan.cc> wrote:
>
> 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.
Git does not set or update the remote HEAD, that's something the user
is supposed to do (for some reason).
The only exception is when cloning a repository.
In my opinion this is completely unintuitive and unhelpful. 99.99% of
the time I want the remote HEAD to be pointing to where the remote's
HEAD is pointing to.
I implemented patches to fix that [1], but they were never merged.
It's particularly wrong when you are mirroring a repository, as in your case.
> Am I holding the mirror wrong somehow? As far as the manpages say, `git
> remote update` should be enough to fully mirror all refs.
That's what I would expect, but that's not true.
I find that most of the time I need to read git's code to actually
understand what it's supposed to do. I don't bother reading the
documentation.
I've updated my old RFC patch adding tests and an option to make it
work with mirrored repositories as well. With
`fetch.updateHead=always` the mirrored clone always has the HEAD
up-to-date.
Cheers.
[1] https://lore.kernel.org/git/20201118091219.3341585-1-felipe.contreras@gmail.com/
[2] https://lore.kernel.org/git/20230405012742.2452208-1-felipe.contreras@gmail.com/T/#ma012c4823814936a3ab8755d1d2b805d61b43133
--
Felipe Contreras
prev parent reply other threads:[~2023-04-05 1:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP44s1TBUmc6mhGSWQ1v+E5_VRqnCUXURHs2cM-vE22eyndsQ@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=mvdan@mvdan.cc \
/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.
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).