From patchwork Thu May 27 14:17:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Whatson X-Patchwork-Id: 29625 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 C44F927BC81; Thu, 27 May 2021 15:19:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9B23F27BC78 for ; Thu, 27 May 2021 15:19:10 +0100 (BST) Received: from localhost ([::1]:50816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmGqr-0000dt-RA for patchwork@mira.cbaines.net; Thu, 27 May 2021 10:19:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGqk-0000ac-5y for guix-patches@gnu.org; Thu, 27 May 2021 10:19:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGqj-000132-Sx for guix-patches@gnu.org; Thu, 27 May 2021 10:19:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lmGqj-0004zj-Oo for guix-patches@gnu.org; Thu, 27 May 2021 10:19:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of deleted files. Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 May 2021 14:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48698 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48698@debbugs.gnu.org Cc: Andrew Whatson X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162212509919136 (code B ref -1); Thu, 27 May 2021 14:19:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2021 14:18:19 +0000 Received: from localhost ([127.0.0.1]:52478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGq0-0004yW-8C for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:37424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGpz-0004yP-8j for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGpy-0008MF-JL for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:45993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGpw-0000b4-SP for guix-patches@gnu.org; Thu, 27 May 2021 10:18:14 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d16so665018pfn.12 for ; Thu, 27 May 2021 07:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=HfWVtHT+fJf+JLXmz38jvwRWi7zBURBoPFmsLLu0/6Xz8zke0Pk3u18GNwzbJxeqt+ QDtEfc99StyctkZBd9a2/JC8j4xyu4kmNvFPJY2d16Q9Yoq/LR+apmVCGmFiuAz6eaLP qpYNAZhQqSRKvlaUf/o8h1+i8hgM/LmxGXRV5jLvW+gGcQsTtuBJetIj7Yhy4CVL28/m Sx8cWLdUdDCYFpjnQ6HgM1apU+X8lj89gK1m1dotArW/hqEv5Bqq1IVy4p3y/wj54z4k KPbhjv92qbj0Ogov3i0P8OZ3cmE5XY1XfXo/o+kwgTTUxM4aFZ6SvwOe+C3rh50NnzUw ZdYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VvEyl9tq2PGwVwMrXDTE5Udjt28S7nZlhG0UKQwCeT4=; b=uQqVznVorxnZ+rlv3RUfQZfVHHwNAcXUBeCUp3i7Ho5QGQIiOhWIh8S258dnFHkNy4 3i7Kmpa8EF7OpGzUkAVRuojR1MehoQ481QKgfASc3SBGMxJJApSMEiSA2NA1v3HOPlBB tgUc9kI7sy6vVSaKf1a+D2z8bUx9/6scTcaAx54D4kTfCG1FIwTsmzejQ3NQlMUB0w3+ pG555gkpes8c5Lb2P9FFWygDQIp2Q2KCf2CGPU+PERYRCtP69OAm9Hw51wBUR+XjuowA vfPp6rcDc8tFdBuj66pcP48Xbft9kGWb4fxrYQcAWduoAFeiqga5b5Bwu31HevS7Vu4h exeg== X-Gm-Message-State: AOAM533jGA3mLkegooSnXMgp4r9o2pKne2q7mynG3oppxxc8m7qECUYn PNvHer7T2v+op1p6l6chtr6O0Rspdk0= X-Google-Smtp-Source: ABdhPJz//v30l4KkRZnGZ9Y32UvWkGk+6tz2eV93F6jel+owB6rltuh8bqQKgiOAQd6Ir9lEAxfh8w== X-Received: by 2002:aa7:9a8e:0:b029:2e7:e3fd:4fa4 with SMTP id w14-20020aa79a8e0000b02902e7e3fd4fa4mr3972455pfi.63.1622125090148; Thu, 27 May 2021 07:18:10 -0700 (PDT) Received: from muon.fritz.box ([203.221.113.127]) by smtp.gmail.com with ESMTPSA id d18sm2060648pgm.93.2021.05.27.07.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:18:09 -0700 (PDT) From: Andrew Whatson Date: Fri, 28 May 2021 00:17:59 +1000 Message-Id: <20210527141759.2868127-1-whatson@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=whatson@gmail.com; helo=mail-pf1-x42f.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-getmail-retrieved-from-mailbox: Patches When git-predicate is used on an active worktree, some files in the index might not exist on the filesystem. Instead of failing with "No such file or directory", these should be ignored. * guix/git-download.scm (git-predicate): Skip missing files. --- guix/git-download.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/guix/git-download.scm b/guix/git-download.scm index 199effece5..8d8e1c865f 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -231,11 +231,13 @@ absolute file name and STAT is the result of 'lstat'." (lambda () (let* ((files (git-file-list directory)) (inodes (fold (lambda (file result) - (let ((stat - (lstat (string-append directory "/" - file)))) - (vhash-consv (stat:ino stat) (stat:dev stat) - result))) + (let* ((path (string-append directory "/" file)) + (stat (and (file-exists? path) + (lstat path)))) + (if stat + (vhash-consv (stat:ino stat) + (stat:dev stat) result) + result))) vlist-null files))) (lambda (file stat)