guix-commits
[Top][All Lists]
Advanced

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

04/07: git: 'update-cached-checkout' has a new #:check-out? parameter.


From: guix-commits
Subject: 04/07: git: 'update-cached-checkout' has a new #:check-out? parameter.
Date: Wed, 22 Jul 2020 18:26:19 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit a620c9d51d57c8277ec75892c7eee8f9c84fa96f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Jul 15 23:59:05 2020 +0200

    git: 'update-cached-checkout' has a new #:check-out? parameter.
    
    * guix/git.scm (update-cached-checkout): Add #:check-out? parameter and
    honor it.
---
 guix/git.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/guix/git.scm b/guix/git.scm
index ca67b1d..7f8f9ad 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -292,6 +292,7 @@ definitely available in REPOSITORY, false otherwise."
                                  #:key
                                  (ref '(branch . "master"))
                                  recursive?
+                                 (check-out? #t)
                                  starting-commit
                                  (log-port (%make-void-port "w"))
                                  (cache-directory
@@ -306,7 +307,10 @@ provided) as returned by 'commit-relation'.
 REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value
 the associated data: [<branch name> | <sha1> | <tag name> | <string>].
 
-When RECURSIVE? is true, check out submodules as well, if any."
+When RECURSIVE? is true, check out submodules as well, if any.
+
+When CHECK-OUT? is true, reset the cached working tree to REF; otherwise leave
+it unchanged."
   (define canonical-ref
     ;; We used to require callers to specify "origin/" for each branch, which
     ;; made little sense since the cache should be transparent to them.  So
@@ -337,7 +341,10 @@ When RECURSIVE? is true, check out submodules as well, if 
any."
 
      ;; Note: call 'commit-relation' from here because it's more efficient
      ;; than letting users re-open the checkout later on.
-     (let* ((oid      (switch-to-ref repository canonical-ref))
+     (let* ((oid      (if check-out?
+                          (switch-to-ref repository canonical-ref)
+                          (object-id
+                           (resolve-reference repository canonical-ref))))
             (new      (and starting-commit
                            (commit-lookup repository oid)))
             (old      (and starting-commit



reply via email to

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