all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 45187@debbugs.gnu.org
Subject: bug#45187: git download defaults to origin/master
Date: Tue, 15 Dec 2020 06:07:17 GMT	[thread overview]
Message-ID: <87wnxj7gbw.fsf@kyleam.com> (raw)
In-Reply-To: <87zh2gu1ef.fsf@gnu.org>

Ludovic Courtès writes:

>>  (define* (update-cached-checkout url
>>                                   #:key
>> -                                 (ref '(branch . "master"))
>> +                                 (ref '(symref . "refs/remotes/origin/HEAD"))
>>                                   recursive?
>>                                   (check-out? #t)
>>                                   starting-commit
>> @@ -395,7 +398,7 @@ (define* (latest-repository-commit store url
>>                                     (log-port (%make-void-port "w"))
>>                                     (cache-directory
>>                                      (%repository-cache-directory))
>> -                                   (ref '(branch . "master")))
>> +                                   (ref '(symref . "refs/remotes/origin/HEAD")))
>
> Do we really need to add “remotes/origin” in there?  Or is there a way
> to just say HEAD and later specify that we’re talking about the remote
> head, as is done fro branches?

Thanks for the feedback.  Sure, that sounds fine to me.  As far as I can
tell, in this context it'd make sense to assume HEAD should always be
the one under refs/remotes/origin.  (It really was a "quick check that
my suggestion to use the remote HEAD symref works" sort of patch :))

Another thing that doesn't feel suitable for the proper patch is the
introduction of the `symref' symbol...

> We also need to change the defaults in <git-checkout> & co., like Marius did.

...which didn't seem particularly nice to add as a field to
<git-checkout>.

However, without the introduction of something like `symref', I'm not
spotting a straightforward way to deal with refs/remotes/origin/HEAD in
resolve-reference.

FWIW if we were to go in the direction Marius suggested, I believe the
main change needed on top of Marius's patch in order to use the remote
symref would be

diff --git a/guix/git.scm b/guix/git.scm
index 0c49859e42..5caf715916 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -313,9 +313,7 @@ (define* (update-cached-checkout url
       (('branch . branch)
        `(branch . ,(if (string-prefix? "origin/" branch)
                        branch
-                       (if (string=? "HEAD" branch)
-                           branch
-                           (string-append "origin/" branch)))))
+                       (string-append "origin/" branch))))
       (_ ref)))
 
   (with-libgit2




  reply	other threads:[~2020-12-15  6:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 21:02 bug#45187: git download defaults to origin/master Ricardo Wurmus
2020-12-11 23:02 ` Kyle Meyer
2020-12-13 21:52   ` Marius Bakke
2020-12-14  4:49     ` Kyle Meyer
2020-12-14 10:27     ` Ludovic Courtès
2020-12-14 10:28   ` Ludovic Courtès
2020-12-15  6:07     ` Kyle Meyer [this message]
2021-04-08 16:21       ` Ricardo Wurmus
2021-04-09  5:10         ` bug#45187: [PATCH] git: Update cached checkout to the remote HEAD by default Kyle Meyer
2021-04-09 13:50           ` bug#45187: git download defaults to origin/master Ludovic Courtès
2021-04-10  3:50             ` Kyle Meyer
2021-04-10  5:51               ` Kyle Meyer
2021-04-10 19:33               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnxj7gbw.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=45187@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.