GNU bug report logs -
#48698
[PATCH] git-download: Fix 'git-predicate' handling of deleted files.
Previous Next
Reported by: Andrew Whatson <whatson <at> gmail.com>
Date: Thu, 27 May 2021 14:19:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 3 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.