GNU bug report logs - #49252
[PATCH] Channels defaulting to HEAD instead of ‘master’

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 28 Jun 2021 12:57:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Kyle Meyer <kyle <at> kyleam.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 49252 <at> debbugs.gnu.org
Subject: [bug#49252] [PATCH] Channels defaulting to HEAD instead of ‘master’
Date: Thu, 08 Jul 2021 20:38:45 -0400
Ludovic Courtès writes:

> For the record, commit cb41c15827a2e910aa56fb5d1917ba8a085c95c7 by Kyle
> (Cc’d) gives the ability to use the remote HEAD by default, which is
> exactly what we need here.
>
> Unfortunately, for the Guix repo at Savannah, I get:
>
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix time-machine -- describe
> guix time-machine: error: Git error: reference 'refs/remotes/origin/HEAD' not found
> --8<---------------cut here---------------end--------------->8---
>
> … but it works for <https://github.com/guix-mirror/guix>.
>
> Presumably we have a server-side setup issue at Savannah?

Hmm, it looks like it's there:

  $ git ls-remote https://git.savannah.gnu.org/git/guix.git | grep HEAD
  e499500730de23fd54ae63696a725d4b90a406d7	HEAD

  $ git clone https://git.savannah.gnu.org/git/guix.git && cd guix
  $ git for-each-ref refs/remotes/origin | grep HEAD
  e499500730de23fd54ae63696a725d4b90a406d7 commit	refs/remotes/origin/HEAD
  $ git name-rev refs/remotes/origin/HEAD
  refs/remotes/origin/HEAD master

This might be a long shot, but if you cloned the repo with magit-clone,
it has some custom logic that deletes refs/remotes/<remote>/HEAD unless
magit-clone-set-remote-head is non-nil (and it's nil by default).

> Are there downsides, or cases where it might pick the wrong branch?

The main downside I can think of is what I mentioned in bug#45187
(87v9d8dk0r.fsf <at> kyleam.com):

  [The remote HEAD symref] probably the best indicator of what the
  primary branch is.  In a clone, it doesn't necessarily match HEAD on
  the remote, because users may change it to another branch they're
  interested in, but that isn't really relevant to these
  behind-the-scenes checkouts.

So, if it's a user-facing clone, refs/remotes/origin/HEAD isn't a
reliable indicator because users are free to redirect the remote HEAD
symref to another branch of interest [*] or to delete it altogether.

I think channel clones would fall into the "behind the scenes" category,
though, right?


[*] This is discussed here:
    https://lore.kernel.org/git/xmqqlfivwvtw.fsf <at> gitster.c.googlers.com/




This bug report was last modified 3 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.