1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-07 21:50:35 +02:00

git-download: Fix 'git-predicate' file membership.

Previously, it the predicate would return #t for "m4/ChangeLog" if
"ChangeLog" (in the top-level directory) was in FILES.  This commit
fixes the ambiguity.

* guix/git-download.scm (git-predicate): Add 'inodes' variable.  Use it
to determine file membership.
This commit is contained in:
Ludovic Courtès
2017-05-07 18:05:14 +02:00
parent 4da1816628
commit ba2260dbbc

View File

@@ -145,6 +145,10 @@ absolute file name and STAT is the result of 'lstat'."
(reverse lines))
(line
(loop (cons line lines))))))
(inodes (map (lambda (file)
(let ((stat (lstat file)))
(cons (stat:dev stat) (stat:ino stat))))
files))
(status (close-pipe pipe)))
(and (zero? status)
(lambda (file stat)
@@ -155,8 +159,10 @@ absolute file name and STAT is the result of 'lstat'."
(any (lambda (f) (parent-directory? f file))
files))
((or 'regular 'symlink)
(any (lambda (f) (string-suffix? f file))
files))
;; Comparing file names is always tricky business so we rely on
;; inode numbers instead
(member (cons (stat:dev stat) (stat:ino stat))
inodes))
(_
#f))))))