From patchwork Mon Sep 4 08:49:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 53418 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B0BD627BBE9; Mon, 4 Sep 2023 09:50:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D529127BBE2 for ; Mon, 4 Sep 2023 09:50:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qd5Ha-0003Gs-Jj; Mon, 04 Sep 2023 04:50:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qd5HW-0003GG-Pr for guix-patches@gnu.org; Mon, 04 Sep 2023 04:50:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qd5HW-0008P4-GG for guix-patches@gnu.org; Mon, 04 Sep 2023 04:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qd5HW-0002wt-7p for guix-patches@gnu.org; Mon, 04 Sep 2023 04:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65352] Fix time-machine and network Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Sep 2023 08:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65352 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Simon Tournier Cc: 65352@debbugs.gnu.org Received: via spool by 65352-submit@debbugs.gnu.org id=B65352.169381737611286 (code B ref 65352); Mon, 04 Sep 2023 08:50:02 +0000 Received: (at 65352) by debbugs.gnu.org; 4 Sep 2023 08:49:36 +0000 Received: from localhost ([127.0.0.1]:48481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd5H5-0002vx-BU for submit@debbugs.gnu.org; Mon, 04 Sep 2023 04:49:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qd5H2-0002ve-Ew for 65352@debbugs.gnu.org; Mon, 04 Sep 2023 04:49:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qd5Gx-0008K2-8l; Mon, 04 Sep 2023 04:49:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=Ab/atSdWFCjP1hS72wmrDNWPxAsay5Ki2X1h1y+Fqm0=; b=evJfqos/+9hVrwCZoFU+ WkN/HetLxYnI3bYdtMpIAT6hf9fn7o/my9PjboxvafaMZn1llTO0eIUtC27GEsEH9N34avLa9yqNQ uPN4re527IkgHAMxPEGY13Up65pryy5jUSo0id4w0sU3dvLGs61kwYSrFeIGgJxOFP9GAMPY5LwVX eaCXmjFV1VbJtIS5KGpRblCtevu8bZzYeU1oRkH+e4n4WbPlwtxqPujLTsLp0iWONZ/o071TMwPMI jQ3TkA8aoxDXxCBvk7iJh1JoJEuaUwN/zQXUKk5wyftvM0LZxp3iVpEOq5GqVVk0jEMZamzrdypcx J0UeJ7k3D9r/tQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= References: <87fs4h4vb9.fsf@gmail.com> Date: Mon, 04 Sep 2023 10:49:24 +0200 In-Reply-To: (Simon Tournier's message of "Thu, 17 Aug 2023 16:09:16 +0200") Message-ID: <87wmx6qq5n.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi, Simon Tournier skribis: > * guix/git/scm (reference-available?): Rely of the procedure resolve-reference > to determine if the reference belongs to the local Git checkout. > --- > guix/git.scm | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/guix/git.scm b/guix/git.scm > index dbc3b7caa7..ebe2600209 100644 > --- a/guix/git.scm > +++ b/guix/git.scm > @@ -360,17 +360,8 @@ (define-syntax-rule (false-if-git-not-found exp) > (define (reference-available? repository ref) > "Return true if REF, a reference such as '(commit . \"cabba9e\"), is > definitely available in REPOSITORY, false otherwise." > - (match ref > - ((or ('commit . commit) > - ('tag-or-commit . (? commit-id? commit))) > - (let ((len (string-length commit)) > - (oid (string->oid commit))) > - (false-if-git-not-found > - (->bool (if (< len 40) > - (object-lookup-prefix repository oid len OBJ-COMMIT) > - (commit-lookup repository oid)))))) > - (_ > - #f))) > + (false-if-git-not-found > + (->bool (resolve-reference repository ref)))) Houston, we have a problem: --8<---------------cut here---------------start------------->8--- $ guix time-machine -C <(echo %default-channels) -- describe Backtrace: 17 (primitive-load "/home/ludo/.config/guix/current/bin/gu…") In guix/ui.scm: 2323:7 16 (run-guix . _) 2286:10 15 (run-guix-command _ . _) In ice-9/boot-9.scm: 1752:10 14 (with-exception-handler _ _ #:unwind? _ # _) 1747:15 13 (with-exception-handler # …) In guix/store.scm: 672:3 12 (_) In ice-9/boot-9.scm: 1752:10 11 (with-exception-handler _ _ #:unwind? _ # _) In guix/store.scm: 659:37 10 (thunk) In guix/status.scm: 839:4 9 (call-with-status-report _ _) In guix/store.scm: 1298:8 8 (call-with-build-handler # …) In guix/inferior.scm: 932:10 7 (cached-channel-instance # …) In guix/scripts/time-machine.scm: 171:42 6 (validate-guix-channel _) In guix/git.scm: 471:21 5 (update-cached-checkout _ #:ref _ #:recursive? _ # _ # _ …) In ice-9/boot-9.scm: 1747:15 4 (with-exception-handler # …) In guix/git.scm: 364:11 3 (_) 235:4 2 (resolve _) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Throw to key `match-error' with args `("match" "no matching pattern" ())'. $ guix describe Generation 272 Sep 03 2023 23:46:47 (current) guix e365c26 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: e365c26a34fa485f9af46538fcea128db681c33d --8<---------------cut here---------------end--------------->8--- I’m testing the fix below: Ludo’. diff --git a/guix/git.scm b/guix/git.scm index ebe2600209..5fa604f9a0 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2020 Mathieu Othacehe -;;; Copyright © 2018-2022 Ludovic Courtès +;;; Copyright © 2018-2023 Ludovic Courtès ;;; Copyright © 2021 Kyle Meyer ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2022 Maxime Devos @@ -282,7 +282,10 @@ (define (resolve-reference repository ref) (if (= OBJ-TAG (object-type obj)) (object-lookup repository (tag-target-id (tag-lookup repository oid))) - obj)))))) + obj))) + (() + (resolve-reference repository + '(symref . "refs/remotes/origin/HEAD")))))) (define (switch-to-ref repository ref) "Switch to REPOSITORY's branch, commit or tag specified by REF. Return the