From ba2260dbbc5a3c915e2cbd54d93f2f3af2a864c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 May 2017 18:05:14 +0200 Subject: 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. --- guix/git-download.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'guix/git-download.scm') diff --git a/guix/git-download.scm b/guix/git-download.scm index 5d86ab2b62..9f6d20ee38 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -145,6 +145,10 @@ (define (parent-directory? thing directory) (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 @@ (define (parent-directory? thing directory) (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)))))) -- cgit v1.2.3