bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45187: git download defaults to origin/master


From: Ludovic Courtès
Subject: bug#45187: git download defaults to origin/master
Date: Fri, 09 Apr 2021 15:50:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi!

Kyle Meyer <kyle@kyleam.com> skribis:

> Subject: [PATCH] git: Update cached checkout to the remote HEAD by default.
>
> Fixes <https://bugs.gnu.org/45187>.
> Reported by Ricardo Wurmus <rekado@elephly.net>.
>
> update-cached-checkout hard codes "master" as the default branch, leading to a
> failure when the clone doesn't have a "master" branch.  Instead use the remote
> HEAD symref as an indicator of what the primary branch is.
>
> * guix/git.scm (resolve-reference): Support resolving symrefs.
> (update-cached-checkout, latest-repository-commit): Default to the remote HEAD
> symref.
> (<git-checkout>): Add symref field that defaults to "HEAD", and change branch
> field's default to #f.
> (git-checkout-compiler): Handle symref field of <git-checkout>.

[...]

>    git-checkout make-git-checkout
>    git-checkout?
>    (url     git-checkout-url)
> -  (branch  git-checkout-branch (default "master"))
> +  (branch  git-checkout-branch (default #f))
> +  (symref  git-checkout-symref (default "HEAD"))

I know it’s established Git jargon, but “symref” looks obscure to me.
I find it OK for ‘update-cached-checkout’, because it’s an “internal”
procedure for die-hard hackers, but a bit ugly here.

Another option would be to not add this ‘symref’ field and instead, when
‘branch’ and ‘commit’ are both #f, translate that to '(symref . "HEAD").

WDYT?

The rest of the patch LGTM, thanks!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]