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: Kyle Meyer
Subject: bug#45187: git download defaults to origin/master
Date: Mon, 14 Dec 2020 04:49:44 GMT

Marius Bakke writes:

> Kyle Meyer <kyle@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.





reply via email to

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