guix-commits
[Top][All Lists]
Advanced

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

01/04: git: Update the mtime of the just-updated checkout.


From: guix-commits
Subject: 01/04: git: Update the mtime of the just-updated checkout.
Date: Fri, 11 Jun 2021 18:50:47 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit baf0a4288264098ede43e4f7cd099a29fcf35be4
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Jun 11 23:32:45 2021 +0200

    git: Update the mtime of the just-updated checkout.
    
    Reported by zimoun <zimon.toutoune@gmail.com>.
    
    Previously, the mtime of CACHE-DIRECTORY may or may not have been
    updated after a pull.  Thus, 'maybe-remove-expired-cache-entries' could
    potentially delete CACHE-DIRECTORY right before it's returned.
    
    * guix/git.scm (update-cached-checkout): Call 'utime' on CACHE-DIRECTORY.
---
 guix/git.scm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/guix/git.scm b/guix/git.scm
index 57fa2ca..9c6f326 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -424,6 +424,14 @@ it unchanged."
        ;; REPOSITORY as soon as possible.
        (repository-close! repository)
 
+       ;; Update CACHE-DIRECTORY's mtime to so the cache logic sees it.
+       (match (gettimeofday)
+         ((seconds . microseconds)
+          (let ((nanoseconds (* 1000 microseconds)))
+            (utime cache-directory
+                   seconds seconds
+                   nanoseconds nanoseconds))))
+
        ;; When CACHE-DIRECTORY is a sub-directory of the default cache
        ;; directory, remove expired checkouts that are next to it.
        (let ((parent (dirname cache-directory)))



reply via email to

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