all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of deleted files.
@ 2021-05-27 14:17 Andrew Whatson
  2021-05-28 10:10 ` bug#48698: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Whatson @ 2021-05-27 14:17 UTC (permalink / raw)
  To: 48698; +Cc: Andrew Whatson

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-28 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 14:17 [bug#48698] [PATCH] git-download: Fix 'git-predicate' handling of deleted files Andrew Whatson
2021-05-28 10:10 ` bug#48698: " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.