GNU bug report logs -
#45187
git download defaults to origin/master
Previous Next
Full log
Message #14 received at 45187 <at> debbugs.gnu.org (full text, mbox):
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.