From: "Ludovic Courtès" <ludo@gnu.org>
To: 42381@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#42381] [PATCH 2/3] git: 'update-cached-checkout' has a new #:check-out? parameter.
Date: Thu, 16 Jul 2020 01:18:57 +0200 [thread overview]
Message-ID: <20200715231858.10201-2-ludo@gnu.org> (raw)
In-Reply-To: <20200715231858.10201-1-ludo@gnu.org>
* 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 ca67b1d37c..7f8f9addfb 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
--
2.27.0
next prev parent reply other threads:[~2020-07-15 23:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 22:15 [bug#42381] [PATCH 0/3] 'reconfigure' disallows downgrades by default Ludovic Courtès
2020-07-15 23:18 ` [bug#42381] [PATCH 1/3] git: Factorize 'resolve-reference' Ludovic Courtès
2020-07-15 23:18 ` Ludovic Courtès [this message]
2020-07-15 23:18 ` [bug#42381] [PATCH 3/3] guix system: 'reconfigure' disallows downgrades by default Ludovic Courtès
2020-07-22 22:34 ` bug#42381: [PATCH 0/3] " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200715231858.10201-2-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=42381@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).