Message ID | 20210527141759.2868127-1-whatson@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [bug#48698] git-download: Fix 'git-predicate' handling of deleted files. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Hi Andrew, Andrew Whatson <whatson@gmail.com> skribis: > 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. I pushed a slightly different version as 50d5bb1f3e3f080212436db1b8666d061a8ae1d2, mostly avoiding the extra ‘stat’ call induced by ‘file-exists?’. Thanks, Ludo’.
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)