GNU bug report logs - #45187
git download defaults to origin/master

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Fri, 11 Dec 2020 21:04:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kyle Meyer <kyle <at> kyleam.com>
To: Marius Bakke <marius <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 45187 <at> debbugs.gnu.org
Subject: bug#45187: git download defaults to origin/master
Date: Mon, 14 Dec 2020 04:49:44 GMT
Marius Bakke writes:

> Kyle Meyer <kyle <at> kyleam.com> skriver:
>
>> One option may be to use the remote HEAD symref.
[...]
>> Here's a quick and dirty demo that makes your reproducer work.  A real
>> patch in this direction would of course look very different.
>
> Another quick and dirty patch to make this specific example work ...

Thanks.

> diff --git a/guix/git.scm b/guix/git.scm
[...]
>  (define* (update-cached-checkout url
>                                   #:key
> -                                 (ref '(branch . "master"))
> +                                 (ref '(branch . "HEAD"))
>                                   recursive?
>                                   (check-out? #t)
>                                   starting-commit
> @@ -349,7 +313,9 @@ it unchanged."
>        (('branch . branch)
>         `(branch . ,(if (string-prefix? "origin/" branch)
>                         branch
> -                       (string-append "origin/" branch))))
> +                       (if (string=? "HEAD" branch)
> +                           branch
> +                           (string-append "origin/" branch)))))
>        (_ ref)))

I think using HEAD, rather than refs/remotes/origin/HEAD, will be
problematic when the repository is already present in the cache.  If I'm
reading guix/git.scm correctly, a fetch is done in that case.
refs/remotes/origin/HEAD will track any updates on the remote ref that
it points to, while HEAD will stay on the same commit that it landed on
at clone time.




This bug report was last modified 4 years and 101 days ago.

Previous Next


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