[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Ludovic Courtès
Subject: 01/01: git-download: Fix 'git-predicate' file membership.
Date: Sun, 7 May 2017 12:08:19 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit ba2260dbbc5a3c915e2cbd54d93f2f3af2a864c3
Author: Ludovic Courtès <address@hidden>
Date:   Sun May 7 18:05:14 2017 +0200

    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(-)

diff --git a/guix/git-download.scm b/guix/git-download.scm
index 5d86ab2..9f6d20e 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -145,6 +145,10 @@ absolute file name and STAT is the result of 'lstat'."
                            (reverse lines))
                            (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))
              ((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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]