From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id wKRnGq7KWmeEcwEAqHPOHw:P1 (envelope-from ) for ; Thu, 12 Dec 2024 11:36:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wKRnGq7KWmeEcwEAqHPOHw (envelope-from ) for ; Thu, 12 Dec 2024 12:36:14 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=pKFYsZVn; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hlB397VM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734003374; h=from:from:sender:sender: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: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:dkim-signature; bh=UFFo79uacAl0QPVjayuMw5s7YFylSiNLda9DOIZ7Vys=; b=MRleIRCc722Z/6KUsn15hSHwdODD4jlcoJ3FiHbvgkomlRnA1zQYApM+fCulQMkFCrce4Y PTVERRJzVmbbrFtdGEHt5TBogKODi0R0X3e8hnnQvn9RNZB/E05RNdRKnP7ny6q+CGyNu7 gkqjqzawIpi3CPYWjCUSgbs7TB3+J+Bkd6/KGOVdPSZ91zZ57dXPYY3BcNpze4y6ohnsaf Gv4evxi2eKP2iHs7MFfxS9nTHeHeC+w1V/Kjj5/mVsfKxrUQ2PvKKgdG/UOYm01UydqZK/ p5FIGDiQ5Wrm7r3P0fLFwhhDXYdcG990Ys6Gl7+4WsYy3+7cjB/+ROIJUqbJ5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=pKFYsZVn; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hlB397VM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734003374; a=rsa-sha256; cv=none; b=Q2AF++7I3UeImE9ATHyDZ3gEYxrjN7j3M0qRUjG/Tf83INeJkaAU0bwMeCN5TkXdBwl+Xc FhNN/vqu4wlrlbiNVEtglxcpx+e9KiOki6uS5b6b0JY33tcn7mfMMsTvztoFweNtZX9X/H lY+72otw2D+cwlMryaOGRo/pyhVPrwXaxFuOkI6/yvkNPWJUkBufRPqHMC4vnbE01YAk0K WfaUL5eg6VeCsocg2FCM2vqw7ZzgyhCv2zxPcHXb/DaIQpTcXg5QD2aRQAakqpgVnVn0W8 +8d8bS1dIqjya4MSzq9amkJOFvO2FyD8e4gKk35XPJ8+BA96aFZGYaRf0eMh8g== 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 1790F7DE94 for ; Thu, 12 Dec 2024 12:36:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLhUC-0005jm-DK; Thu, 12 Dec 2024 06:36:04 -0500 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 1tLhUB-0005jd-71 for guix-patches@gnu.org; Thu, 12 Dec 2024 06:36:03 -0500 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 1tLhUA-0003nS-Us for guix-patches@gnu.org; Thu, 12 Dec 2024 06:36:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=UFFo79uacAl0QPVjayuMw5s7YFylSiNLda9DOIZ7Vys=; b=pKFYsZVnkOfWfMP8OgDP+bVl++2UABdlhFXkv8D9mpVdqsl+Wq7MOB7yAy1M2iRlv3AnPuTxarWJ7REqNMf7D5hM50fEdGydAbs0V2BhedeR1TUm+lLX6xHIG7L4hIpSpZdNuBGzOxXnpF7CIoh8BTueKVlpLmQB14QEyz7nqHFPhWIIVdMI7LhH9kDLXuVUZh4GMPy3dzlytEV6Q7C4Pph5Ls8cgkn+4IffwCtvqVYA7C0iQ4jNOJhc4F56sR0cnSC2+xGTaGExgyNPPGW91KeamMww7pUPLljScc6gZKYjEFrmDaMR7umk4iws1mBUdCHRWdEcWAtGbgHUST9Ivg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tLhU9-0002YF-OO for guix-patches@gnu.org; Thu, 12 Dec 2024 06:36:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74481] [PATCH 1/2] git: Catch Git errors when updating cached checkout. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 12 Dec 2024 11:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74481 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: 74481@debbugs.gnu.org, Josselin Poiret , Tobias Geerinckx-Rice , Mathieu Othacehe , Christopher Baines Received: via spool by 74481-submit@debbugs.gnu.org id=B74481.17340033119730 (code B ref 74481); Thu, 12 Dec 2024 11:36:01 +0000 Received: (at 74481) by debbugs.gnu.org; 12 Dec 2024 11:35:11 +0000 Received: from localhost ([127.0.0.1]:37950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLhTK-0002Wi-Fp for submit@debbugs.gnu.org; Thu, 12 Dec 2024 06:35:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLhTI-0002R8-DW for 74481@debbugs.gnu.org; Thu, 12 Dec 2024 06:35:09 -0500 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 1tLhTA-0003We-95; Thu, 12 Dec 2024 06:35:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=UFFo79uacAl0QPVjayuMw5s7YFylSiNLda9DOIZ7Vys=; b=hlB397VMe2GOy7Mipydp Vuv2HiZcqRdcUt8NHw8vU1mROB/ezgdqv5mctyKsjcxWiL6zQ2ijQ8Z/8EtlQxqYEirxUrXljPD1p cKA9XgKmuerD7OaOb5OIIy6WjsjuhDO0HzrZkmTTkQ/glGpDdFc4YGlFTTtm/hVdZ9MRS1XCz1sPA 3USvAWnJlnRq/X5+imbouBKL0TufARCQkiqcbDIC0ln6jldHiWgheFRqWM66ZuuLFAOFOqAHrQ9Dy dQs53ip3dCvf6Fvb1TmL6rRcdqfSMyWupuTzO/87/e/iarAGUdmjYxYSkLLmyyYQ0p7NyIUgAQFaJ PU7ngavto190vg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Simon Tournier's message of "Fri, 22 Nov 2024 20:09:26 +0100") References: Date: Thu, 12 Dec 2024 12:34:57 +0100 Message-ID: <87bjxhb0da.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 0.63 X-Spam-Score: 0.63 X-Migadu-Queue-Id: 1790F7DE94 X-TUID: 1p7iviJ3pCFL Hi, Simon Tournier skribis: > * guix/git.scm (resolve-reference): Catch Git error when reference does n= ot > exist and return #false. > (switch-to-ref): Adjust. > (update-cached-checkout)[close-and-clean!]: New helper. > Catch Git error when reference does not exist and warn. > Return #false values when reference does not exist. > > Change-Id: If6e244fe40ebee978ec8de51a6a68bcbd4a2c79e [...] > (define (resolve-reference repository ref) > "Resolve the branch, commit or tag specified by REF, and return the > -corresponding Git object." > +corresponding Git object. Return #false if REF is not found." > (let resolve ((ref ref)) > (match ref > (('branch . branch) > @@ -281,9 +281,12 @@ (define (resolve-reference repository ref) > ;; can't be sure it's available. Furthermore, 'string->oid' us= ed to > ;; read out-of-bounds when passed a string shorter than 40 char= s, > ;; which is why we delay calls to it below. > - (if (< len 40) > - (object-lookup-prefix repository (string->oid commit) len) > - (object-lookup repository (string->oid commit))))) > + (catch 'git-error > + (lambda () > + (if (< len 40) > + (object-lookup-prefix repository (string->oid commit) l= en) > + (object-lookup repository (string->oid commit)))) > + (lambda _ #f)))) > (('tag-or-commit . str) > (cond ((and (string-contains str "-g") > (match (string-split str #\-) > @@ -300,7 +303,10 @@ (define (resolve-reference repository ref) > =3D> (lambda (commit) (resolve `(commit . ,commit)))) > ((or (> (string-length str) 40) > (not (string-every char-set:hex-digit str))) > - (resolve `(tag . ,str))) ;definitely a tag > + (catch 'git-error ;definitely a tag > + (lambda () > + (resolve `(tag . ,str))) > + (lambda _ #f))) Sorry for not replynig earlier. I would avoid such a change: it changes the semantics of =E2=80=98resolve-reference=E2=80=99 in a non-trivial and h= ard-to-test way. Instead, since the goal is to address a problem that=E2=80=99s specific to importers (or to one importer), I would suggest making a local change in the importer itself, or in code that is shared among importers only. (This comment applies to this entire patch.) Ludo=E2=80=99.