From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 11 Dec 2020 21:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 45187@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16077205858321 (code B ref -1); Fri, 11 Dec 2020 21:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Dec 2020 21:03:05 +0000 Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knpZB-0002A9-0Q for submit@debbugs.gnu.org; Fri, 11 Dec 2020 16:03:05 -0500 Received: from lists.gnu.org ([209.51.188.17]:55562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knpZ9-0002A1-82 for submit@debbugs.gnu.org; Fri, 11 Dec 2020 16:03:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knpZ8-0008Fc-1N for bug-guix@gnu.org; Fri, 11 Dec 2020 16:03:02 -0500 Received: from sender4-of-o50.zoho.com ([136.143.188.50]:21024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knpZ0-0002MV-GO for bug-guix@gnu.org; Fri, 11 Dec 2020 16:03:01 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1607720566; cv=none; d=zohomail.com; s=zohoarc; b=GFjofyDxgwMCPfrp6SDNyAaeqN0BQdBkO/5NN4gKiBYPuKCdJf6UWV9a+OaOpg9Ih3HVjfqz9qVDNs5EQhn+DGhb2LFwwDfpZrwqHqUkZOKQqZSaea6je9ZgFQmRftBkGvyQP3gs7lu25kM0PaGZ+L72A+iZy7OLX171XxXkslE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607720566; h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To; bh=E5fC//HFOgkBiMCVSil1FwBfWDyWiudCiTeAHGn10XU=; b=ShyYrUZks8FOvD2LIuGJ+79i7S979Ok+l2B8Jzsx2yEC2CZRwvax/EWA/COGh+dXvgAxSAnF+k/ADl7UPUdvQRovFM/4NjBB3w99a7NwMshyPcHm9BIZiBk1y8BcMdnNvAXO0hplAdlCgucEaWjVo+4qiHqbAoQwzfuRdZEiXrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1607720566; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=E5fC//HFOgkBiMCVSil1FwBfWDyWiudCiTeAHGn10XU=; b=MbvIOX6Gl2Mv1+6MAZwa48nVfkND6h7BUGED7ALcdiYJDFhLAV4IVzLMAwwg7Lcd gCd/KBBG/pAkROV6G51wqAInuFmf7MHR9tQdX0DYv8E08jml0FJdcR/YDmkiM7Qq0lR 6HKjJfzRpDs8TKEN/ypg2k0HMaajxrS4+tNXD4RI= Received: from localhost (p54ad4b85.dip0.t-ipconnect.de [84.173.75.133]) by mx.zohomail.com with SMTPS id 160772056388365.22647467927823; Fri, 11 Dec 2020 13:02:43 -0800 (PST) User-agent: mu4e 1.4.13; emacs 27.1 From: Ricardo Wurmus X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Fri, 11 Dec 2020 22:02:40 +0100 Message-ID: <878sa4vyxb.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.50; envelope-from=rekado@elephly.net; helo=sender4-of-o50.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Importing https://github.com/immunogenomics/scpost with the CRAN importer fails, because the git repository does not have an origin/master branch. This repository only has a =E2=80=9Cmain=E2=80=9D br= anch. Arguably, this shouldn=E2=80=99t matter, but (guix git) has the =E2=80=9Cma= ster=E2=80=9D name set up as the default. When cloning a repository it may be better to fetch everything and select the default branch =E2=80=94 whichever name it = may have. Here is a reproducer: --8<---------------cut here---------------start------------->8--- $ guix import cran -r -a git https://github.com/immunogenomics/scpost Backtrace: In ice-9/boot-9.scm: 1736:10 19 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) 1731:15 18 (with-exception-handler # =E2=80=A6) In guix/scripts/import/cran.scm: 103:26 17 (_) In guix/import/utils.scm: 458:31 16 (recursive-import "https://github.com/immunogenomics/scpost" #= _ #:guix-name =E2=80=A6) 449:33 15 (lookup-node "https://github.com/immunogenomics/scpost" #f) In guix/memoization.scm: 98:0 14 (mproc "https://github.com/immunogenomics/scpost" #:version #f= #:repo git) In unknown file: 13 (_ #= # =E2=80=A6) In guix/import/cran.scm: 576:24 12 (_ "https://github.com/immunogenomics/scpost" #:repo _ #:versi= on _) 269:25 11 (fetch-description _ "https://github.com/immunogenomics/scpost= ") In guix/memoization.scm: 98:0 10 (mproc "https://github.com/immunogenomics/scpost" #:method git) In unknown file: 9 (_ #= # =E2=80=A6) In ice-9/boot-9.scm: 1736:10 8 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In guix/store.scm: 632:37 7 (thunk) In guix/git.scm: 424:8 6 (latest-repository-commit # "https://=E2=80=A6" =E2=80=A6) 240:2 5 (update-cached-checkout _ #:ref _ #:recursive? _ #:check-out? = _ # _ # _ # _) 208:19 4 (resolve _) In git/branch.scm: 101:8 3 (_ _ _ _) In git/bindings.scm: 77:2 2 (raise-git-error _) In ice-9/boot-9.scm: 1669:16 1 (raise-exception _ #:continuable? _) 1669:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1669:16: In procedure raise-exception: Git error: cannot locate remote-tracking branch 'origin/master' --8<---------------cut here---------------end--------------->8--- --=20 Ricardo From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 11 Dec 2020 23:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ricardo Wurmus Cc: 45187@debbugs.gnu.org Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.160772772719390 (code B ref 45187); Fri, 11 Dec 2020 23:03:01 +0000 Received: (at 45187) by debbugs.gnu.org; 11 Dec 2020 23:02:07 +0000 Received: from localhost ([127.0.0.1]:43569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knrQM-00052f-UO for submit@debbugs.gnu.org; Fri, 11 Dec 2020 18:02:07 -0500 Received: from out0.migadu.com ([94.23.1.103]:18226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knrQJ-00052V-Tr for 45187@debbugs.gnu.org; Fri, 11 Dec 2020 18:02:06 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1607727722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iG2LJjNKZknfLauMSUlJwRPYgcahh6ruptycDFUcpPw=; b=QtVQR5dZK8j/A6mKIsSp4jgiL23MjHnJVssIIOKH2W7cwRBAb4zeS5zj6XbGxmgim87hao SbodyjiyCIBi477FaI2/i5Ylvv2uTZrUTyEZjv/NdVVqeIFadmFA2Q3FhPU7dP7mTbzJ8Z L9PXkyqzXHvWc+RBdpBVsryFOqfPs42a7g0Nm/rRDdMzk3TvGVEi5e2SF941VdTcdWgIjh ZlXrXIIPWjQLma6lNgLECMim7+gCoT3TiZKPSfI9QV9k+7YsnQL1h7nANW2HfkBC6KrH+q ManJLfeL2qRI6QrOztoP2bMZ9BZwvufOMxA9c0HhfTi18eONgVwCMtNsW07Xfw== From: Kyle Meyer In-Reply-To: <878sa4vyxb.fsf@elephly.net> References: <878sa4vyxb.fsf@elephly.net> Message-ID: <87v9d8dk0r.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com Date: Fri, 11 Dec 2020 23:02:02 GMT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ricardo Wurmus writes: > Importing https://github.com/immunogenomics/scpost with the CRAN > importer fails, because the git repository does not have an > origin/master branch. This repository only has a =E2=80=9Cmain=E2=80=9D = branch. > > Arguably, this shouldn=E2=80=99t matter, but (guix git) has the =E2=80=9C= master=E2=80=9D name > set up as the default. When cloning a repository it may be better to > fetch everything and select the default branch =E2=80=94 whichever name i= t may > have. One option may be to use the remote HEAD symref. That's probably the best indicator of what the primary branch is. In a clone, it doesn't necessarily match HEAD on the remote, because users may change it to another branch they're interested in, but that isn't really relevant to these behind-the-scenes checkouts. Here's a quick and dirty demo that makes your reproducer work. A real patch in this direction would of course look very different. diff --git a/guix/git.scm b/guix/git.scm index ca77b9f54b..7320c0d6c8 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -207,6 +207,9 @@ (define (resolve-reference repository ref) (let ((oid (reference-target (branch-lookup repository branch BRANCH-REMOTE)))) (object-lookup repository oid))) + (('symref . symref) + (let ((oid (reference-name->oid repository symref))) + (object-lookup repository oid))) (('commit . commit) (let ((len (string-length commit))) ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, so = we @@ -320,7 +323,7 @@ (define (reference-available? repository ref) =20 (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/HE= AD"))) "Return two values: the content of the git repository at URL copied into= a store directory and the sha1 of the top level commit in this directory. T= he reference to be checkout, once the repository is fetched, is specified by = REF. From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 13 Dec 2020 21:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Kyle Meyer , Ricardo Wurmus Cc: 45187@debbugs.gnu.org Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.16078963795148 (code B ref 45187); Sun, 13 Dec 2020 21:53:01 +0000 Received: (at 45187) by debbugs.gnu.org; 13 Dec 2020 21:52:59 +0000 Received: from localhost ([127.0.0.1]:50626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koZIY-0001Kx-MA for submit@debbugs.gnu.org; Sun, 13 Dec 2020 16:52:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1koZIX-0001KT-6X for 45187@debbugs.gnu.org; Sun, 13 Dec 2020 16:52:57 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43102) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koZIR-00010F-1t; Sun, 13 Dec 2020 16:52:51 -0500 Received: from host-37-191-236-253.lynet.no ([37.191.236.253]:44954 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1koZIQ-0006ju-2f; Sun, 13 Dec 2020 16:52:50 -0500 From: Marius Bakke In-Reply-To: <87v9d8dk0r.fsf@kyleam.com> References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> Date: Sun, 13 Dec 2020 22:52:46 +0100 Message-ID: <87lfe19xw1.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Kyle Meyer skriver: > Ricardo Wurmus writes: > >> Importing https://github.com/immunogenomics/scpost with the CRAN >> importer fails, because the git repository does not have an >> origin/master branch. This repository only has a =E2=80=9Cmain=E2=80=9D= branch. >> >> Arguably, this shouldn=E2=80=99t matter, but (guix git) has the =E2=80= =9Cmaster=E2=80=9D name >> set up as the default. When cloning a repository it may be better to >> fetch everything and select the default branch =E2=80=94 whichever name = it may >> have. > > One option may be to use the remote HEAD symref. That's probably the > best indicator of what the primary branch is. In a clone, it doesn't > necessarily match HEAD on the remote, because users may change it to > another branch they're interested in, but that isn't really relevant to > these behind-the-scenes checkouts. > > 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 ... --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=diff Content-Transfer-Encoding: quoted-printable diff --git a/guix/git.scm b/guix/git.scm index ca77b9f54b..0c49859e42 100644 =2D-- a/guix/git.scm +++ b/guix/git.scm @@ -198,47 +198,11 @@ of SHA1 string." (last (string-split url #\/)) ".git" "") "-" (string-take sha1 7))) =20 =2D(define (resolve-reference repository ref) =2D "Resolve the branch, commit or tag specified by REF, and return the =2Dcorresponding Git object." =2D (let resolve ((ref ref)) =2D (match ref =2D (('branch . branch) =2D (let ((oid (reference-target =2D (branch-lookup repository branch BRANCH-REMOTE)))) =2D (object-lookup repository oid))) =2D (('commit . commit) =2D (let ((len (string-length commit))) =2D ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, s= o we =2D ;; can't be sure it's available. Furthermore, 'string->oid' us= ed to =2D ;; read out-of-bounds when passed a string shorter than 40 char= s, =2D ;; which is why we delay calls to it below. =2D (if (< len 40) =2D (object-lookup-prefix repository (string->oid commit) len) =2D (object-lookup repository (string->oid commit))))) =2D (('tag-or-commit . str) =2D (if (or (> (string-length str) 40) =2D (not (string-every char-set:hex-digit str))) =2D (resolve `(tag . ,str)) ;definitely a tag =2D (catch 'git-error =2D (lambda () =2D (resolve `(tag . ,str))) =2D (lambda _ =2D ;; There's no such tag, so it must be a commit ID. =2D (resolve `(commit . ,str)))))) =2D (('tag . tag) =2D (let ((oid (reference-name->oid repository =2D (string-append "refs/tags/" tag))= )) =2D ;; OID may point to a "tag" object, but it can also point direc= tly =2D ;; to a "commit" object, as surprising as it may seem. Return = that =2D ;; object, whatever that is. =2D (object-lookup repository oid)))))) =2D (define (switch-to-ref repository ref) "Switch to REPOSITORY's branch, commit or tag specified by REF. Return = the OID (roughly the commit hash) corresponding to REF." (define obj =2D (resolve-reference repository ref)) + (revparse-single repository (cdr ref))) =20 (reset repository obj RESET_HARD) (object-id obj)) @@ -320,7 +284,7 @@ definitely available in REPOSITORY, false otherwise." =20 (define* (update-cached-checkout url #:key =2D (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 =2D (string-append "origin/" branch)))) + (if (string=3D? "HEAD" branch) + branch + (string-append "origin/" branch))))) (_ ref))) =20 (with-libgit2 @@ -370,8 +336,7 @@ it unchanged." ;; than letting users re-open the checkout later on. (let* ((oid (if check-out? (switch-to-ref repository canonical-ref) =2D (object-id =2D (resolve-reference repository canonical-ref))= )) + (revparse-single repository (cdr canonical-ref))= )) (new (and starting-commit (commit-lookup repository oid))) (old (and starting-commit @@ -395,7 +360,7 @@ it unchanged." (log-port (%make-void-port "w")) (cache-directory (%repository-cache-directory)) =2D (ref '(branch . "master"))) + (ref '(branch . "HEAD"))) "Return two values: the content of the git repository at URL copied into= a store directory and the sha1 of the top level commit in this directory. T= he reference to be checkout, once the repository is fetched, is specified by = REF. @@ -510,7 +475,7 @@ objects: 'ancestor (meaning that OLD is an ancestor of = NEW), 'descendant, or git-checkout make-git-checkout git-checkout? (url git-checkout-url) =2D (branch git-checkout-branch (default "master")) + (branch git-checkout-branch (default "HEAD")) (commit git-checkout-commit (default #f)) ;#f | tag | commit (recursive? git-checkout-recursive? (default #f))) =20 @@ -550,7 +515,7 @@ objects: 'ancestor (meaning that OLD is an ancestor of = NEW), 'descendant, or (($ url branch commit recursive?) (latest-repository-commit* url #:ref (if commit =2D `(tag-or-commit . ,commit) + `(commit . ,commit) `(branch . ,branch)) #:recursive? recursive? #:log-port (current-error-port))))) --=-=-= Content-Type: text/plain I wonder if there was a specific reason to not use 'revparse-single', and instead mostly reinvent it with (resolve-reference ...). This approach can be simplified further by deprecating the 'commit' and 'branch' fields, and just use a single reference string. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFDBAEBCgAtFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl/WjS4PHG1hcml1c0Bn bnUub3JnAAoJEKKgbfKjOlT6FykIAIodtjZIVzwsRRb+7+1b7MRWQmnxQoy2QQs6 0exMoFaYIX/G3NOfE+RWVjcCgIyIc1iua18GKIe990+5uI8dGezOqBkg3/KqrDZc 90jfz2o/IoudaTKEcH3Hp52h4JDkRLnbhiB8b08pZ2NxzsiBWDSaQoWf21m5y0AD GBtZqcX/n3diNkoJ9giSx+xVLlnGqxKXzugTxmnGc/A5AwRLpa+vO7Z15EwCBZ3K ZYh6zGXkFP1hS08Gk41KPjG8JKbtuZx5zxu+iV7K9hXwptOrEepFX9Lio4YNpigi hB31CyW2ITV891Ut/nmqOgihRCChKvGOIwgPN7z6jiAd0gbjriM= =q4BH -----END PGP SIGNATURE----- --==-=-=-- From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 14 Dec 2020 04:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Marius Bakke Cc: Ricardo Wurmus , 45187@debbugs.gnu.org Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.160792138920143 (code B ref 45187); Mon, 14 Dec 2020 04:50:02 +0000 Received: (at 45187) by debbugs.gnu.org; 14 Dec 2020 04:49:49 +0000 Received: from localhost ([127.0.0.1]:50814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kofnx-0005Ep-Fd for submit@debbugs.gnu.org; Sun, 13 Dec 2020 23:49:49 -0500 Received: from out0.migadu.com ([94.23.1.103]:43052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kofnu-0005Ef-EN for 45187@debbugs.gnu.org; Sun, 13 Dec 2020 23:49:47 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1607921384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cbarIz7CXRCCIR273YQDlCXvSgJaJJ4KTuyIomnSfB4=; b=fKKPqW6ryTRm876QXsEZxxun8nJZ80a7tRGSAvobypT9N4gOHuZlDJClDTANLxWw0WhSKX 8YA1Xif5C7V3XmSVEGX0qAq+9osmWlqFBkroxVdiPhEKe5PiUicSvYc6v2smhJcFWMjB7u II+NVIbMcA763HmlKsgv7Pp5zCfYgfics3I721lBrGlv2AIZUv7DcDdQnTxjGNQhyfmgZj FZ+98YCwQCEbrDZGcS/k2fYKYBXP/mw1wRboQyT8TiCVYHjvB7iBnuzlId0+6qTMIA0xO1 5YhsLqlvaTNOc0jJncEOQnf4A18x4JMt26Dq7s9MPL2cEvn5VqiByD5rJskqfQ== From: Kyle Meyer In-Reply-To: <87lfe19xw1.fsf@gnu.org> References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> <87lfe19xw1.fsf@gnu.org> Message-ID: <87lfe1t2jd.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com Date: Mon, 14 Dec 2020 04:49:44 GMT X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Marius Bakke writes: > Kyle Meyer 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. From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 14 Dec 2020 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Marius Bakke Cc: Ricardo Wurmus , Kyle Meyer , 45187@debbugs.gnu.org Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.160794164428421 (code B ref 45187); Mon, 14 Dec 2020 10:28:02 +0000 Received: (at 45187) by debbugs.gnu.org; 14 Dec 2020 10:27:24 +0000 Received: from localhost ([127.0.0.1]:51280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kol4e-0007OL-7h for submit@debbugs.gnu.org; Mon, 14 Dec 2020 05:27:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kol4b-0007O2-TC for 45187@debbugs.gnu.org; Mon, 14 Dec 2020 05:27:22 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49745) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kol4W-0001UL-CF; Mon, 14 Dec 2020 05:27:16 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39940 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kol4U-0002ro-6d; Mon, 14 Dec 2020 05:27:14 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> <87lfe19xw1.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Frimaire an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 14 Dec 2020 11:27:12 +0100 In-Reply-To: <87lfe19xw1.fsf@gnu.org> (Marius Bakke's message of "Sun, 13 Dec 2020 22:52:46 +0100") Message-ID: <874kkovg1r.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Marius Bakke skribis: > I wonder if there was a specific reason to not use 'revparse-single', > and instead mostly reinvent it with (resolve-reference ...). It must have been ignorance on my side, but also the fact that something like =E2=80=98revparse-single=E2=80=99 has to guess what it is you=E2=80=99= re looking for (is this string a commit ID? a tag name? a branch name?), whereas here we can explicitly state what we want and thus reduce the search space and ambiguity. Does that make sense? Ludo=E2=80=99. From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 14 Dec 2020 10:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Kyle Meyer Cc: Ricardo Wurmus , 45187@debbugs.gnu.org Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.160794174728597 (code B ref 45187); Mon, 14 Dec 2020 10:30:01 +0000 Received: (at 45187) by debbugs.gnu.org; 14 Dec 2020 10:29:07 +0000 Received: from localhost ([127.0.0.1]:51287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kol6I-0007RB-Tj for submit@debbugs.gnu.org; Mon, 14 Dec 2020 05:29:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kol6H-0007Qh-Hn for 45187@debbugs.gnu.org; Mon, 14 Dec 2020 05:29:05 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49755) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kol6B-0001j0-Sz; Mon, 14 Dec 2020 05:28:59 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39942 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kol6A-0005vR-5Y; Mon, 14 Dec 2020 05:28:59 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 Frimaire an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 14 Dec 2020 11:28:56 +0100 In-Reply-To: <87v9d8dk0r.fsf@kyleam.com> (Kyle Meyer's message of "Fri, 11 Dec 2020 23:02:02 GMT") Message-ID: <87zh2gu1ef.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Kyle Meyer skribis: > diff --git a/guix/git.scm b/guix/git.scm > index ca77b9f54b..7320c0d6c8 100644 > --- a/guix/git.scm > +++ b/guix/git.scm > @@ -207,6 +207,9 @@ (define (resolve-reference repository ref) > (let ((oid (reference-target > (branch-lookup repository branch BRANCH-REMOTE)))) > (object-lookup repository oid))) > + (('symref . symref) > + (let ((oid (reference-name->oid repository symref))) > + (object-lookup repository oid))) > (('commit . commit) > (let ((len (string-length commit))) > ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, s= o we > @@ -320,7 +323,7 @@ (define (reference-available? repository ref) >=20=20 > (define* (update-cached-checkout url > #:key > - (ref '(branch . "master")) > + (ref '(symref . "refs/remotes/origin/HE= AD")) > 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 =E2=80=9Cremotes/origin=E2=80=9D in there? Or is = there a way to just say HEAD and later specify that we=E2=80=99re talking about the rem= ote head, as is done fro branches? We also need to change the defaults in & co., like Marius di= d. Thanks, Ludo=E2=80=99. From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 15 Dec 2020 06:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Ricardo Wurmus , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.160801244119764 (code B ref 45187); Tue, 15 Dec 2020 06:08:01 +0000 Received: (at 45187) by debbugs.gnu.org; 15 Dec 2020 06:07:21 +0000 Received: from localhost ([127.0.0.1]:55094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kp3UX-00058h-GJ for submit@debbugs.gnu.org; Tue, 15 Dec 2020 01:07:21 -0500 Received: from out1.migadu.com ([91.121.223.63]:43032) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kp3UU-00058Y-R8 for 45187@debbugs.gnu.org; Tue, 15 Dec 2020 01:07:20 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1608012437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WPDFu2Hm7tgFMC80KCn+LPz8ajeeC4Zj3PXQiux/6Cw=; b=BPRuVa8IZaHonLrWJThp5Dsoox2BjA1alKR/DedvSxCL7xMUOZPVAMZhEini6WssU/7nFW jc5FCg1STaNSSk8rkY9XvdnGzMie60pa5XV7iZANfLaxWVMKeIkVrSlFLVZSlB3jVHsIp1 laZO5XdCbea8DzNGLU6WGe9BrJR1Rrs+xU3A8cD21wzfsAqxgOXtL/dP1f8sEJL578ETA4 Ysk6Dg+6Ai+rAgKhNoCDPf+GaiUVbcUc6X7dgnXzYv5jWasdLHPKjAL3O3ME7hUTT0ndlR QHfQOAqQN02Nv5WfGWKqqdDq31mcOqx901tS01ddXeWnZwrto7zaYHzCvPB4XQ== From: Kyle Meyer In-Reply-To: <87zh2gu1ef.fsf@gnu.org> References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> <87zh2gu1ef.fsf@gnu.org> Message-ID: <87wnxj7gbw.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com Date: Tue, 15 Dec 2020 06:07:17 GMT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: >> (define* (update-cached-checkout url >> #:key >> - (ref '(branch . "master")) >> + (ref '(symref . "refs/remotes/origin/H= EAD")) >> 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 =E2=80=9Cremotes/origin=E2=80=9D in there? Or i= s there a way > to just say HEAD and later specify that we=E2=80=99re talking about the r= emote > 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 & co., like Marius = did. ...which didn't seem particularly nice to add as a field to . 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=3D? "HEAD" branch) - branch - (string-append "origin/" branch))))) + (string-append "origin/" branch)))) (_ ref))) =20 (with-libgit2 From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 08 Apr 2021 16:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Kyle Meyer Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.16178988945068 (code B ref 45187); Thu, 08 Apr 2021 16:22:02 +0000 Received: (at 45187) by debbugs.gnu.org; 8 Apr 2021 16:21:34 +0000 Received: from localhost ([127.0.0.1]:48063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUXPS-0001Jg-HH for submit@debbugs.gnu.org; Thu, 08 Apr 2021 12:21:34 -0400 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUXPQ-0001JY-FB for 45187@debbugs.gnu.org; Thu, 08 Apr 2021 12:21:33 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1617898879; cv=none; d=zohomail.com; s=zohoarc; b=ngNOnuRxnpoHvMU0/3C7PX3AeCViRzqgsYI5KDD+sb5AfCxZlOeUKuREjNHmvs3QfiYlrclhP2w9104b7yWTOpVThdSHTY/tKdXK/dDW3kJZIk6dLZx+ktBgNnAC6GvzrAYctVcwRG/zm6d/amwhovVNoHuUC4lr0mk6ZuKXLQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617898879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=gXLE9T5Bw0fpuI8xmpuFsSnKS3/BWbhVujyizON97KY=; b=Sc2r1XWjdQOMO6DbmWidoAodeAQYnNC3Ftdh6CV6R/rYaBZCN29zIwvm/aiy9ilBIX/u5SCNC6aa/7FWRRermPa+5AwJmarT1oabSz6p6Ml++GOOHJUmiUcJY1buJQ+up64Ad54tqFlxEDbfieQ5iSojrRzbuCgbgRgszfyLR1E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1617898879; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=gXLE9T5Bw0fpuI8xmpuFsSnKS3/BWbhVujyizON97KY=; b=C8jY0m1aKElnnTSvRd2fDi5+eVWRjMGqLMllufjqBHTlnwTigC0rvPpXd+IADJDP vIVaq+U8/SGY8yuJ8oeVghOcdqaBw4ZKficOWY4DGqhou66NaplPkQF5mvzP95ZhITK 7KEGoZp+e1S3jFKKqUJq7WgGZ+RyF2Rly8yEv4xY= Received: from localhost (p54ad4c52.dip0.t-ipconnect.de [84.173.76.82]) by mx.zohomail.com with SMTPS id 1617898875667480.265100921249; Thu, 8 Apr 2021 09:21:15 -0700 (PDT) References: <878sa4vyxb.fsf@elephly.net> <87v9d8dk0r.fsf@kyleam.com> <87zh2gu1ef.fsf@gnu.org> <87wnxj7gbw.fsf@kyleam.com> User-agent: mu4e 1.4.15; emacs 27.2 From: Ricardo Wurmus In-reply-to: <87wnxj7gbw.fsf@kyleam.com> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Thu, 08 Apr 2021 18:21:11 +0200 Message-ID: <87ft00ycg8.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, I=E2=80=99d just like to say that I successfully used Kyle=E2=80=99s first = patch to get past the problem. Thank you! I=E2=80=99m a bit lost: is there something we need to decide on to move this forward? (The issue has become a bit more pressing as origin/main is the new default on Github since a while.) --=20 Ricardo From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: [PATCH] git: Update cached checkout to the remote HEAD by default. References: <878sa4vyxb.fsf@elephly.net> Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 09 Apr 2021 05:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ricardo Wurmus Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.161794503321966 (code B ref 45187); Fri, 09 Apr 2021 05:11:01 +0000 Received: (at 45187) by debbugs.gnu.org; 9 Apr 2021 05:10:33 +0000 Received: from localhost ([127.0.0.1]:48932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUjPd-0005iD-7c for submit@debbugs.gnu.org; Fri, 09 Apr 2021 01:10:33 -0400 Received: from out1.migadu.com ([91.121.223.63]:17209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUjPX-0005i0-Kb for 45187@debbugs.gnu.org; Fri, 09 Apr 2021 01:10:31 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1617945025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=DK3jNEC1QeWp2hbqijJ/lPanKFDFa98PkL8E1ba/mSs=; b=MqGlsorgx2Z5tiE7BeMc77VBKgZswLANJJsJ0lSuQCaJGWI9CgGNjOUdUv6v5pmMHZLoUu FFdFJP6vSuzR4XehuQz+PpVmphwok9ZTy046RgENpux7l7bzcVrIb6cEBIw2UsRJOgiRCR EX6rzc6JRBZZZPNk4MF5f3/pDAcHELgsLhR/GnhPy8iyWxpHWrcTQFcf/ar8Ww6bTXCHg1 pyOirmyDGz+H1/p9eZ2CeGqux4i0SRZCBrgrsQPpIKEWI8S0SbPMIqxONI7vyIwoPq2WZs fW+Vg8MQ8dOWWzY9qxczKGX4PleTJH8v+noA7DlNuQCgHCRW5NW+5rxDoKtuyQ== From: Kyle Meyer In-Reply-To: <87ft00ycg8.fsf@elephly.net> Date: Fri, 09 Apr 2021 01:10:22 -0400 Message-ID: <875z0wt54x.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Ricardo Wurmus writes: > I=E2=80=99m a bit lost: is there something we need to decide on to move t= his > forward? I guess the main open question is whether to rework things to use revparse-single as Marius suggested. And if we don't, another question (raised by me) is whether there's a better approach than adding the additional symref key/field. As I said upthread, "without the introduction of something like `symref', I'm not spotting a straightforward way to deal with refs/remotes/origin/HEAD in resolve-reference". > (The issue has become a bit more pressing as origin/main is the new > default on Github since a while.) Right, thanks for bumping this. Here's my attempt to put together a complete patch. I've tested this with $ guix import cran -r -a git https://github.com/immunogenomics/scpost as well as a few `guix build --with-(branch|commit)=3D...' invocations. Running `make check', I don't see any new failures, though I see the same two failures ("channel-news, one entry" and "tests/guix-git-authenticate.sh") on master and with this patch. I haven't yet looked more closely at those. -- >8 -- Subject: [PATCH] git: Update cached checkout to the remote HEAD by default. Fixes . Reported by Ricardo Wurmus . update-cached-checkout hard codes "master" as the default branch, leading t= o a failure when the clone doesn't have a "master" branch. Instead use the rem= ote 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 H= EAD symref. (): Add symref field that defaults to "HEAD", and change bran= ch field's default to #f. (git-checkout-compiler): Handle symref field of . --- guix/git.scm | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index 1820036f25..6b410ed42f 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017, 2020 Mathieu Othacehe ;;; Copyright =C2=A9 2018, 2019, 2020, 2021 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2021 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -209,6 +210,9 @@ (define (resolve-reference repository ref) (let ((oid (reference-target (branch-lookup repository branch BRANCH-REMOTE)))) (object-lookup repository oid))) + (('symref . symref) + (let ((oid (reference-name->oid repository symref))) + (object-lookup repository oid))) (('commit . commit) (let ((len (string-length commit))) ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, so = we @@ -340,7 +344,7 @@ (define (delete-checkout directory) =20 (define* (update-cached-checkout url #:key - (ref '(branch . "master")) + (ref '(symref . "HEAD")) recursive? (check-out? #t) starting-commit @@ -354,8 +358,9 @@ (define* (update-cached-checkout url to REF, and the relation of the new commit relative to STARTING-COMMIT (if provided) as returned by 'commit-relation'. =20 -REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value -the associated data: [ | | | ]. +REF is pair whose key is [branch | commit | tag | tag-or-commit | symref] = and +value the associated data: +[ | | | | ]. =20 When RECURSIVE? is true, check out submodules as well, if any. =20 @@ -378,6 +383,10 @@ (define* (update-cached-checkout url `(branch . ,(if (string-prefix? "origin/" branch) branch (string-append "origin/" branch)))) + (('symref . symref) + `(symref . ,(if (string-prefix? "refs/remotes/origin/" symref) + symref + (string-append "refs/remotes/origin/" symref)))) (_ ref))) =20 (with-libgit2 @@ -433,12 +442,12 @@ (define* (latest-repository-commit store url (log-port (%make-void-port "w")) (cache-directory (%repository-cache-directory)) - (ref '(branch . "master"))) + (ref '(symref . "HEAD"))) "Return two values: the content of the git repository at URL copied into= a store directory and the sha1 of the top level commit in this directory. T= he reference to be checkout, once the repository is fetched, is specified by = REF. -REF is pair whose key is [branch | commit | tag] and value the associated -data, respectively [ | | ]. +REF is pair whose key is [branch | commit | tag | symref] and value the +associated data, respectively [ | | | ]. =20 When RECURSIVE? is true, check out submodules as well, if any. =20 @@ -548,7 +557,8 @@ (define-record-type* 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")) (commit git-checkout-commit (default #f)) ;#f | tag | commit (recursive? git-checkout-recursive? (default #f))) =20 @@ -585,11 +595,14 @@ (define-gexp-compiler (git-checkout-compiler (checkou= t ) ;; "Compile" CHECKOUT by updating the local checkout and adding it to the ;; store. (match checkout - (($ url branch commit recursive?) + (($ url branch symref commit recursive?) (latest-repository-commit* url - #:ref (if commit - `(tag-or-commit . ,commit) - `(branch . ,branch)) + #:ref (cond (commit + `(tag-or-commit . ,commit)) + (branch + `(branch . ,branch)) + (else + `(symref . ,symref))) #:recursive? recursive? #:log-port (current-error-port))))) =20 base-commit: 43c55856c876c76200cdccc1211868b92352c4ae --=20 2.31.1 From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 09 Apr 2021 13:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Kyle Meyer Cc: Ricardo Wurmus , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.161797625227182 (code B ref 45187); Fri, 09 Apr 2021 13:51:01 +0000 Received: (at 45187) by debbugs.gnu.org; 9 Apr 2021 13:50:52 +0000 Received: from localhost ([127.0.0.1]:49284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUrXA-00074M-FK for submit@debbugs.gnu.org; Fri, 09 Apr 2021 09:50:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUrX8-000743-Fj for 45187@debbugs.gnu.org; Fri, 09 Apr 2021 09:50:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50956) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lUrX2-00027Z-Vo; Fri, 09 Apr 2021 09:50:44 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36960 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lUrX1-0003Xb-CR; Fri, 09 Apr 2021 09:50:43 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <878sa4vyxb.fsf@elephly.net> <875z0wt54x.fsf@kyleam.com> Date: Fri, 09 Apr 2021 15:50:41 +0200 In-Reply-To: <875z0wt54x.fsf@kyleam.com> (Kyle Meyer's message of "Fri, 09 Apr 2021 01:10:22 -0400") Message-ID: <87fszz7ej2.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! Kyle Meyer skribis: > Subject: [PATCH] git: Update cached checkout to the remote HEAD by defaul= t. > > Fixes . > Reported by Ricardo Wurmus . > > 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 r= emote > 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. > (): Add symref field that defaults to "HEAD", and change br= anch > field's default to #f. > (git-checkout-compiler): Handle symref field of . [...] > 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=E2=80=99s established Git jargon, but =E2=80=9Csymref=E2=80=9D lo= oks obscure to me. I find it OK for =E2=80=98update-cached-checkout=E2=80=99, because it=E2=80= =99s an =E2=80=9Cinternal=E2=80=9D procedure for die-hard hackers, but a bit ugly here. Another option would be to not add this =E2=80=98symref=E2=80=99 field and = instead, when =E2=80=98branch=E2=80=99 and =E2=80=98commit=E2=80=99 are both #f, translat= e that to '(symref . "HEAD"). WDYT? The rest of the patch LGTM, thanks! Ludo=E2=80=99. From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master References: <878sa4vyxb.fsf@elephly.net> Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 10 Apr 2021 03:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Ricardo Wurmus , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.161802662626597 (code B ref 45187); Sat, 10 Apr 2021 03:51:02 +0000 Received: (at 45187) by debbugs.gnu.org; 10 Apr 2021 03:50:26 +0000 Received: from localhost ([127.0.0.1]:51255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV4dd-0006uv-6e for submit@debbugs.gnu.org; Fri, 09 Apr 2021 23:50:25 -0400 Received: from out1.migadu.com ([91.121.223.63]:31784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV4da-0006uj-9z for 45187@debbugs.gnu.org; Fri, 09 Apr 2021 23:50:24 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1618026620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=/A3BJGfm4TYOo3jO5mJ5FZljiZQApIAww+nM6rsEF4Y=; b=G9dRPMrAJIv1UBTIDIEj4qlZcOnG7mp3N6PhUpcCKiMv9FUj+ACNDDd8fsnWcWv45HiWTX fuxwH58mZGdB1tlW2O43KkO7hygl59+r5/zGi8xgFV5+MIAHt54RzIcgGhNgiU57P5z7Va wAT/2OspWauOQ6vBF5dAJ51ypfenKXKJnQ9gtrN9X55yA8F8AoXV6GeajsW4lzKeZVBhdS 0APcrS1YkSS6lvKRF4dWXOPBB73wCsxRwdu3PlKf6ZnqMsaGVijHDdg5tGtZqOBb5nQv8G niJpwTRLXR1nhxZfUkn0wXeTWpyM97pK+QpVsNmyX3qpekmuJOTKTNHNjkhc5Q== From: Kyle Meyer In-Reply-To: <87fszz7ej2.fsf_-_@gnu.org> Date: Fri, 09 Apr 2021 23:50:13 -0400 Message-ID: <87v98ussqy.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Ludovic Court=C3=A8s writes: > Kyle Meyer skribis: [...] >> 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=E2=80=99s established Git jargon, but =E2=80=9Csymref=E2=80=9D = looks obscure to me. > I find it OK for =E2=80=98update-cached-checkout=E2=80=99, because it=E2= =80=99s an =E2=80=9Cinternal=E2=80=9D > procedure for die-hard hackers, but a bit ugly here. Agreed. As mentioned upthread, I don't like it either. > Another option would be to not add this =E2=80=98symref=E2=80=99 field an= d instead, when > =E2=80=98branch=E2=80=99 and =E2=80=98commit=E2=80=99 are both #f, transl= ate that to '(symref . "HEAD"). > > WDYT? Thanks for the suggestion. Dropping the field and translating downstream sounds good to me. Working through the patch update, I ended up moving things even more internally, making update-cached-checkout translate the empty list into (symref . "refs/remotes/origin/HEAD") for resolve-reference. I don't think there will be a use for symrefs other than HEAD, so it seemed reasonable to add the special case (or rather shift the special case all the way down into update-cached-checkout). Let me know if you'd rather use a (symref . "HEAD") default for update-cached-checkout. > The rest of the patch LGTM, thanks! Thanks for the review. -- >8 -- Subject: [PATCH v2] git: Update cached checkout to the remote HEAD by defau= lt. Fixes . Reported by Ricardo Wurmus . update-cached-checkout hard codes "master" as the default branch, leading t= o a failure when the clone doesn't have a "master" branch. Instead use the rem= ote 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): Change the default for = REF to the empty list and translate it to the remote HEAD symref. (): Change branch field's default to #f. (git-checkout-compiler): When branch and commit fields are both #f, call latest-repository-commit* with the empty list as the ref. --- guix/git.scm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index 1820036f25..5d9f0bf205 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017, 2020 Mathieu Othacehe ;;; Copyright =C2=A9 2018, 2019, 2020, 2021 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2021 Kyle Meyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -209,6 +210,9 @@ (define (resolve-reference repository ref) (let ((oid (reference-target (branch-lookup repository branch BRANCH-REMOTE)))) (object-lookup repository oid))) + (('symref . symref) + (let ((oid (reference-name->oid repository symref))) + (object-lookup repository oid))) (('commit . commit) (let ((len (string-length commit))) ;; 'object-lookup-prefix' appeared in Guile-Git in Mar. 2018, so = we @@ -340,7 +344,7 @@ (define (delete-checkout directory) =20 (define* (update-cached-checkout url #:key - (ref '(branch . "master")) + (ref '()) recursive? (check-out? #t) starting-commit @@ -356,6 +360,7 @@ (define* (update-cached-checkout url =20 REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value the associated data: [ | | | ]. +IF REF is the empty list, the remote HEAD is used. =20 When RECURSIVE? is true, check out submodules as well, if any. =20 @@ -374,6 +379,7 @@ (define* (update-cached-checkout url ;; made little sense since the cache should be transparent to them. So ;; here we append "origin/" if it's missing and otherwise keep it. (match ref + (() '(symref . "refs/remotes/origin/HEAD")) (('branch . branch) `(branch . ,(if (string-prefix? "origin/" branch) branch @@ -433,12 +439,13 @@ (define* (latest-repository-commit store url (log-port (%make-void-port "w")) (cache-directory (%repository-cache-directory)) - (ref '(branch . "master"))) + (ref '())) "Return two values: the content of the git repository at URL copied into= a store directory and the sha1 of the top level commit in this directory. T= he reference to be checkout, once the repository is fetched, is specified by = REF. REF is pair whose key is [branch | commit | tag] and value the associated -data, respectively [ | | ]. +data, respectively [ | | ]. IF REF is the e= mpty +list, the remote HEAD is used. =20 When RECURSIVE? is true, check out submodules as well, if any. =20 @@ -548,7 +555,7 @@ (define-record-type* git-checkout make-git-checkout git-checkout? (url git-checkout-url) - (branch git-checkout-branch (default "master")) + (branch git-checkout-branch (default #f)) (commit git-checkout-commit (default #f)) ;#f | tag | commit (recursive? git-checkout-recursive? (default #f))) =20 @@ -587,9 +594,11 @@ (define-gexp-compiler (git-checkout-compiler (checkout= ) (match checkout (($ url branch commit recursive?) (latest-repository-commit* url - #:ref (if commit - `(tag-or-commit . ,commit) - `(branch . ,branch)) + #:ref (cond (commit + `(tag-or-commit . ,commit)) + (branch + `(branch . ,branch)) + (else '())) #:recursive? recursive? #:log-port (current-error-port))))) =20 base-commit: f68bcc1bc3aa0a8d1829e2eb5d9ef256c817c17c --=20 2.31.1 From unknown Mon Aug 18 18:03:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45187: git download defaults to origin/master Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 10 Apr 2021 05:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45187 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Ricardo Wurmus , 45187@debbugs.gnu.org, Marius Bakke Received: via spool by 45187-submit@debbugs.gnu.org id=B45187.16180338786020 (code B ref 45187); Sat, 10 Apr 2021 05:52:02 +0000 Received: (at 45187) by debbugs.gnu.org; 10 Apr 2021 05:51:18 +0000 Received: from localhost ([127.0.0.1]:51305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV6Wc-0001Z2-2M for submit@debbugs.gnu.org; Sat, 10 Apr 2021 01:51:18 -0400 Received: from out1.migadu.com ([91.121.223.63]:23099) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lV6WW-0001Yp-7l for 45187@debbugs.gnu.org; Sat, 10 Apr 2021 01:51:17 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1618033870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lYgSMgUt+k6p61Sn6CV3yL4C8MBd4EHEFTQKsDGOG0M=; b=BOFAsanswTDqOsjbJmX4ZyMEmpUGZVO7yD3fnmf5QY+XVjMieXaOGyr4cYHqGIT5j36Fy8 U3gLpcT8RGCeyXieROsR8+kfAjjPK1Je+u33U6NxfOefCrKTvT/8PRwpjdDrzUJt6kktRn ew4rrE3amryq0jdnmW2K+2B1c5iulgtzAk4Lh/iWFfRLDwA/RojtsSCpFr4GDG4XOAg0Un qWxxWZ77iMfOkgGCtG6cZn0aG/jQjWTAR61VEbWvLrR9YejLTf7FJTO9UISMkgz3sxov1F sYdpyl/DD61AR0mtz9MOfmeF9dZmMWU7GY9Ws8pNAozJV4jxrIPVIptTC/BPsg== From: Kyle Meyer In-Reply-To: <87v98ussqy.fsf@kyleam.com> References: <87v98ussqy.fsf@kyleam.com> Date: Sat, 10 Apr 2021 01:51:08 -0400 Message-ID: <87zgy6ofg3.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Kyle Meyer writes: > @@ -356,6 +360,7 @@ (define* (update-cached-checkout url > > REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value > the associated data: [ | | | ]. > +IF REF is the empty list, the remote HEAD is used. Sorry, here and ... > @@ -433,12 +439,13 @@ (define* (latest-repository-commit store url > (log-port (%make-void-port "w")) > (cache-directory > (%repository-cache-directory)) > - (ref '(branch . "master"))) > + (ref '())) > "Return two values: the content of the git repository at URL copied into a > store directory and the sha1 of the top level commit in this directory. The > reference to be checkout, once the repository is fetched, is specified by REF. > REF is pair whose key is [branch | commit | tag] and value the associated > -data, respectively [ | | ]. > +data, respectively [ | | ]. IF REF is the empty > +list, the remote HEAD is used. ... here should say "If" rather than "IF". From unknown Mon Aug 18 18:03:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ricardo Wurmus Subject: bug#45187: closed (Re: bug#45187: git download defaults to origin/master) Message-ID: References: <874kge2avn.fsf@gnu.org> <878sa4vyxb.fsf@elephly.net> X-Gnu-PR-Message: they-closed 45187 X-Gnu-PR-Package: guix Reply-To: 45187@debbugs.gnu.org Date: Sat, 10 Apr 2021 19:34:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1618083242-27516-1" This is a multi-part message in MIME format... ------------=_1618083242-27516-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45187: git download defaults to origin/master which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45187@debbugs.gnu.org. --=20 45187: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45187 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1618083242-27516-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45187-done) by debbugs.gnu.org; 10 Apr 2021 19:33:13 +0000 Received: from localhost ([127.0.0.1]:53318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVJM0-00078j-Uo for submit@debbugs.gnu.org; Sat, 10 Apr 2021 15:33:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVJLy-00078S-Tx for 45187-done@debbugs.gnu.org; Sat, 10 Apr 2021 15:33:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49510) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVJLr-0004Du-LU; Sat, 10 Apr 2021 15:33:03 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41738 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lVJLq-0004K5-MX; Sat, 10 Apr 2021 15:33:03 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Kyle Meyer Subject: Re: bug#45187: git download defaults to origin/master References: <87v98ussqy.fsf@kyleam.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 21 Germinal an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 10 Apr 2021 21:33:00 +0200 In-Reply-To: <87v98ussqy.fsf@kyleam.com> (Kyle Meyer's message of "Fri, 09 Apr 2021 23:50:13 -0400") Message-ID: <874kge2avn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 45187-done Cc: Ricardo Wurmus , 45187-done@debbugs.gnu.org, Marius Bakke X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Kyle, Kyle Meyer skribis: > Subject: [PATCH v2] git: Update cached checkout to the remote HEAD by def= ault. > > Fixes . > Reported by Ricardo Wurmus . > > 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 r= emote > 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): Change the default fo= r REF > to the empty list and translate it to the remote HEAD symref. > (): Change branch field's default to #f. > (git-checkout-compiler): When branch and commit fields are both #f, call > latest-repository-commit* with the empty list as the ref. > --- > guix/git.scm | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) Applied, thanks! Ludo=E2=80=99. ------------=_1618083242-27516-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Dec 2020 21:03:05 +0000 Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knpZB-0002A9-0Q for submit@debbugs.gnu.org; Fri, 11 Dec 2020 16:03:05 -0500 Received: from lists.gnu.org ([209.51.188.17]:55562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1knpZ9-0002A1-82 for submit@debbugs.gnu.org; Fri, 11 Dec 2020 16:03:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knpZ8-0008Fc-1N for bug-guix@gnu.org; Fri, 11 Dec 2020 16:03:02 -0500 Received: from sender4-of-o50.zoho.com ([136.143.188.50]:21024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knpZ0-0002MV-GO for bug-guix@gnu.org; Fri, 11 Dec 2020 16:03:01 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1607720566; cv=none; d=zohomail.com; s=zohoarc; b=GFjofyDxgwMCPfrp6SDNyAaeqN0BQdBkO/5NN4gKiBYPuKCdJf6UWV9a+OaOpg9Ih3HVjfqz9qVDNs5EQhn+DGhb2LFwwDfpZrwqHqUkZOKQqZSaea6je9ZgFQmRftBkGvyQP3gs7lu25kM0PaGZ+L72A+iZy7OLX171XxXkslE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607720566; h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To; bh=E5fC//HFOgkBiMCVSil1FwBfWDyWiudCiTeAHGn10XU=; b=ShyYrUZks8FOvD2LIuGJ+79i7S979Ok+l2B8Jzsx2yEC2CZRwvax/EWA/COGh+dXvgAxSAnF+k/ADl7UPUdvQRovFM/4NjBB3w99a7NwMshyPcHm9BIZiBk1y8BcMdnNvAXO0hplAdlCgucEaWjVo+4qiHqbAoQwzfuRdZEiXrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1607720566; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=E5fC//HFOgkBiMCVSil1FwBfWDyWiudCiTeAHGn10XU=; b=MbvIOX6Gl2Mv1+6MAZwa48nVfkND6h7BUGED7ALcdiYJDFhLAV4IVzLMAwwg7Lcd gCd/KBBG/pAkROV6G51wqAInuFmf7MHR9tQdX0DYv8E08jml0FJdcR/YDmkiM7Qq0lR 6HKjJfzRpDs8TKEN/ypg2k0HMaajxrS4+tNXD4RI= Received: from localhost (p54ad4b85.dip0.t-ipconnect.de [84.173.75.133]) by mx.zohomail.com with SMTPS id 160772056388365.22647467927823; Fri, 11 Dec 2020 13:02:43 -0800 (PST) User-agent: mu4e 1.4.13; emacs 27.1 From: Ricardo Wurmus To: bug-guix@gnu.org Subject: git download defaults to origin/master X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Fri, 11 Dec 2020 22:02:40 +0100 Message-ID: <878sa4vyxb.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.50; envelope-from=rekado@elephly.net; helo=sender4-of-o50.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Importing https://github.com/immunogenomics/scpost with the CRAN importer fails, because the git repository does not have an origin/master branch. This repository only has a =E2=80=9Cmain=E2=80=9D br= anch. Arguably, this shouldn=E2=80=99t matter, but (guix git) has the =E2=80=9Cma= ster=E2=80=9D name set up as the default. When cloning a repository it may be better to fetch everything and select the default branch =E2=80=94 whichever name it = may have. Here is a reproducer: --8<---------------cut here---------------start------------->8--- $ guix import cran -r -a git https://github.com/immunogenomics/scpost Backtrace: In ice-9/boot-9.scm: 1736:10 19 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) 1731:15 18 (with-exception-handler # =E2=80=A6) In guix/scripts/import/cran.scm: 103:26 17 (_) In guix/import/utils.scm: 458:31 16 (recursive-import "https://github.com/immunogenomics/scpost" #= _ #:guix-name =E2=80=A6) 449:33 15 (lookup-node "https://github.com/immunogenomics/scpost" #f) In guix/memoization.scm: 98:0 14 (mproc "https://github.com/immunogenomics/scpost" #:version #f= #:repo git) In unknown file: 13 (_ #= # =E2=80=A6) In guix/import/cran.scm: 576:24 12 (_ "https://github.com/immunogenomics/scpost" #:repo _ #:versi= on _) 269:25 11 (fetch-description _ "https://github.com/immunogenomics/scpost= ") In guix/memoization.scm: 98:0 10 (mproc "https://github.com/immunogenomics/scpost" #:method git) In unknown file: 9 (_ #= # =E2=80=A6) In ice-9/boot-9.scm: 1736:10 8 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In guix/store.scm: 632:37 7 (thunk) In guix/git.scm: 424:8 6 (latest-repository-commit # "https://=E2=80=A6" =E2=80=A6) 240:2 5 (update-cached-checkout _ #:ref _ #:recursive? _ #:check-out? = _ # _ # _ # _) 208:19 4 (resolve _) In git/branch.scm: 101:8 3 (_ _ _ _) In git/bindings.scm: 77:2 2 (raise-git-error _) In ice-9/boot-9.scm: 1669:16 1 (raise-exception _ #:continuable? _) 1669:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1669:16: In procedure raise-exception: Git error: cannot locate remote-tracking branch 'origin/master' --8<---------------cut here---------------end--------------->8--- --=20 Ricardo ------------=_1618083242-27516-1--