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

Re: Syncing HEAD

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 14, 2018, 22:05 UTC
Message-ID
<87a7pohadr.fsf@evledraar.gmail.com>
In-Reply-To
<CAP8UFD0_jpKdcDvNx5CYnmyDMagE_O-E7cef5VthaT_w-=4xsA@mail.gmail.com>
On Tue, Aug 14 2018, Christian Couder wrote:
Show 41 quoted lines
> Hi,
>
> When cloning with --mirror, the clone gets its HEAD initialized with
> the value HEAD has in its origin remote. After that if HEAD changes in
> origin there is no simple way to sync HEAD at the same time as the
> refs are synced.
>
> It looks like the simplest way to sync HEAD is:
>
> 1) git remote show origin
> 2) parse "HEAD branch: XXX" from the output of the above command
> 3) git symbolic-ref HEAD refs/heads/XXX
>
> It looks like it would be quite easy to add an option to `fetch` to
> sync HEAD at the same time as regular refs are synced because every
> fetch from an origin that uses a recent Git contains something like:
>
> 19:55:39.304976 pkt-line.c:80           packet:          git< YYYYYYYY
> HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow
> deepen-since deepen-not deepen-relative no-progress include-tag
> multi_ack_detailed no-done symref=HEAD:refs/heads/test-1
> agent=git/2.18.0
>
> which in this example shows that HEAD is a symref to refs/heads/test-1
> in origin.
>
> Is there a reason why no such option already exists? Would it makes
> sense to add one? Is there any reason why it's not a good idea? Or am
> I missing something?
>
> I am asking because GitLab uses HEAD in the bare repos it manages to
> store the default branch against which the Merge Requests (same thing
> as Pull Requests on GitHub) are created.
>
> So when people want to keep 2 GitLab hosted repos in sync, GitLab
> needs to sync HEADs too, not just the refs.
>
> I think this could be useful to other setups than GitLab though.
>
> Thanks,
> Christian.

Isn't this some other facet of (or the same) bug I reported in https://public-inbox.org/git/87bmcyfh67.fsf@evledraar.gmail.com/ ?

Previous: Jeff King
Message 10 of 10 in “Syncing HEAD”
  1. Christian CouderAug 14, 2018
  2. Stefan BellerAug 14, 2018
  3. Brandon WilliamsAug 14, 2018
  4. Jeff KingAug 14, 2018
  5. Jeff KingAug 14, 2018
  6. Christian CouderAug 15, 2018
  7. Jeff KingAug 17, 2018
  8. Junio C HamanoAug 17, 2018
  9. Jeff KingAug 17, 2018
  10. Ævar Arnfjörð BjarmasonAug 14, 2018

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.