From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uOhyKVxKNWEYfAAAgWs5BA (envelope-from ) for ; Mon, 06 Sep 2021 00:53:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6FlnJFxKNWHnTQAAB5/wlQ (envelope-from ) for ; Sun, 05 Sep 2021 22:53:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 40B858CFB for ; Mon, 6 Sep 2021 00:53:16 +0200 (CEST) Received: from localhost ([::1]:46576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mN10k-0003ux-2r for larch@yhetil.org; Sun, 05 Sep 2021 18:53:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN10Z-0003ul-Aw for guix-patches@gnu.org; Sun, 05 Sep 2021 18:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mN10Z-0001NK-4A for guix-patches@gnu.org; Sun, 05 Sep 2021 18:53:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mN10Z-0000Xs-3C for guix-patches@gnu.org; Sun, 05 Sep 2021 18:53:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50377] [PATCH v2 1/2] git: 'resolve-reference' handles 'git describe'-style commit IDs. Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 05 Sep 2021 22:53:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50377 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50377@debbugs.gnu.org Received: via spool by 50377-submit@debbugs.gnu.org id=B50377.16308823392027 (code B ref 50377); Sun, 05 Sep 2021 22:53:03 +0000 Received: (at 50377) by debbugs.gnu.org; 5 Sep 2021 22:52:19 +0000 Received: from localhost ([127.0.0.1]:51148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mN0zr-0000Wc-8r for submit@debbugs.gnu.org; Sun, 05 Sep 2021 18:52:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mN0zp-0000WM-Hm for 50377@debbugs.gnu.org; Sun, 05 Sep 2021 18:52:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47120) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mN0zk-0000q5-AS for 50377@debbugs.gnu.org; Sun, 05 Sep 2021 18:52:12 -0400 Received: from host-37-191-231-185.lynet.no ([37.191.231.185]:38038 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN0zj-0003Ad-IA for 50377@debbugs.gnu.org; Sun, 05 Sep 2021 18:52:12 -0400 From: Marius Bakke In-Reply-To: <20210904181035.24161-1-marius@gnu.org> References: <20210904180845.23915-1-marius@gnu.org> <20210904181035.24161-1-marius@gnu.org> Date: Mon, 06 Sep 2021 00:52:08 +0200 Message-ID: <87pmtmprdz.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630882396; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=xeJFs3QVZaAO9kClO8D7CJK+HqkYG9P4EPNd95SlIAI=; b=drLahJrzwx6lbg3x7N5DfrvLHjoEoXRXObXyG8w6ZK4oB8EcxUuc7ib/GWd+yv22RXc+48 y2/v8mUsG5QGKO0FyBe86l5eIKxtDtBmpZmu6TxokYSGFzLMWkfq0X/LHWnFGQ0hZakEX9 5c0xEgnN7TLByM3Bsm3mOk8yItQAg9syW9uc6XnFRtMMa+Alw92ukXmHPEZNHDyHyo0LJI rwMIe40FhJQ2/hdfkqsl8bP/d+EPPNgEV1tu6e5bWwuO0IOgtgs7hCMbqTudyAoT+p3n1D eicLutj+Mj3/Ul7rbX8YLTnH6LdNpXpXpMbwv7unJjP3cxGXTv63IQ6drjmVxw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630882396; a=rsa-sha256; cv=none; b=jjbYYXPIDc3ank/OMoC6guePhkWEcP3hm86+s1HbbcsYgeAL5X0MXssrZU3DF8IJSp8r5i 964X1wRpIPxvkAyxaFwzVySH+T3/Aa+iEa0A5yGDu2PIacYy46UoKlfJoxrErydN2GB829 GIq5smQaSN2TsbWNE4YN/BiJmTvWEocLppaGZ0uNgrbbz0p1Brj4RLrih6BvU/RhDr4+zs ZcsG3zWz+a6Ljp+G8rdTtgwGt4ms2m5D+vYkHmPVbYyPc9Q5/QBU49aOj45O5gn3/0Mv3B uL7DSQ/qsR4AwIT7RkFZ/w+S0Nv6k61MiH3z/1obURafUcmZAswC8bX472bYvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -5.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 40B858CFB X-Spam-Score: -5.01 X-Migadu-Scanner: scn1.migadu.com X-TUID: OIS6qt/8MilC --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Marius Bakke skriver: > * guix/git.scm (resolve-reference): Use REVPARSE-SINGLE for looking up > commits. Rewrite tag-or-commit case to recognize 'git describe' style > identifiers and resolve them as commits. I realize we can do this without resorting to 'revparse-single', which does essentially the same as this procedure. We just have to extract the short commit from the describe string. New patch attached: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-git-resolve-reference-handles-git-describe-style-com.patch Content-Transfer-Encoding: quoted-printable From=209af0f5fd7d8209ffe94d9e0007f58a1a475fe4f1 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 6 Sep 2021 00:21:51 +0200 Subject: [PATCH] git: 'resolve-reference' handles 'git describe'-style comm= it IDs. * guix/git.scm (resolve-reference): Rewrite tag-or-commit case to recognize 'git describe' style identifiers and resolve them as commits. =2D-- guix/git.scm | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index 9c6f326c36..09efab1182 100644 =2D-- a/guix/git.scm +++ b/guix/git.scm @@ -2,6 +2,7 @@ ;;; Copyright =C2=A9 2017, 2020 Mathieu Othacehe ;;; Copyright =C2=A9 2018, 2019, 2020, 2021 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2021 Kyle Meyer +;;; Copyright =C2=A9 2021 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -223,15 +224,28 @@ corresponding Git object." (object-lookup-prefix repository (string->oid commit) len) (object-lookup repository (string->oid commit))))) (('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)))))) + (cond ((and (string-contains str "-g") + (match (string-split str #\-) + ((version ... revision g+commit) + (if (and (> (string-length g+commit) 7) + (string-every char-set:digit revision) + (string-every char-set:hex-digit + (string-drop g+commit 1))) + ;; Looks like a 'git describe' style id, like + ;; v1.3.0-7-gaa34d4d28d. + (resolve `(commit . ,(string-drop g+commit 1))) + #f)) + (_ #f)))) + ((or (> (string-length str) 40) + (not (string-every char-set:hex-digit str))) + (resolve `(tag . ,str))) ;definitely a tag + (else + (catch 'git-error + (lambda () + (resolve `(tag . ,str))) + (lambda _ + ;; There's no such tag, so it must be a commit ID. + (resolve `(commit . ,str))))))) (('tag . tag) (let ((oid (reference-name->oid repository (string-append "refs/tags/" tag)))) =2D-=20 2.31.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIUEARYKAC0WIQRNTknu3zbaMQ2ddzTocYulkRQQdwUCYTVKGA8cbWFyaXVzQGdu dS5vcmcACgkQ6HGLpZEUEHdqUgEAn/KBuJVZlKIxYrCFM1wFvHWEXUeFypdbOGpn pquIx9oA/iNtoBXjhDVN3iH3GrkVMP6cmJcuaDsC5yBw8AEGjBUI =PU6n -----END PGP SIGNATURE----- --==-=-=--