store: Memoize 'add-to-store' based on the result of 'lstat', not 'stat'.
* guix/store.scm (add-to-store): Change 'stat' call to 'lstat'. Clarify docstring.
This commit is contained in:
parent
020f3e4156
commit
69792b285c
@ -610,11 +610,12 @@ path."
|
||||
store-path)))
|
||||
(lambda (server basename recursive? hash-algo file-name)
|
||||
"Add the contents of FILE-NAME under BASENAME to the store. When
|
||||
RECURSIVE? is true and FILE-NAME designates a directory, the contents of
|
||||
FILE-NAME are added recursively; if FILE-NAME designates a flat file and
|
||||
RECURSIVE? is true, its contents are added, and its permission bits are
|
||||
kept. HASH-ALGO must be a string such as \"sha256\"."
|
||||
(let* ((st (stat file-name #f))
|
||||
RECURSIVE? is false, FILE-NAME must designate a regular file--not a directory
|
||||
nor a symlink. When RECURSIVE? is true and FILE-NAME designates a directory,
|
||||
the contents of FILE-NAME are added recursively; if FILE-NAME designates a
|
||||
flat file and RECURSIVE? is true, its contents are added, and its permission
|
||||
bits are kept. HASH-ALGO must be a string such as \"sha256\"."
|
||||
(let* ((st (false-if-exception (lstat file-name)))
|
||||
(args `(,st ,basename ,recursive? ,hash-algo))
|
||||
(cache (nix-server-add-to-store-cache server)))
|
||||
(or (and st (hash-ref cache args))
|
||||
|
Loading…
Reference in New Issue
Block a user