guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of delete


From: Andrew Whatson
Subject: [bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of deleted files.
Date: Fri, 28 May 2021 00:17:59 +1000

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)
-- 
2.31.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]