mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
git: Fix update cached checkout when not a symref.
Follow up of 66463356ce
.
* guix/git.scm (update-cached-checkout)[symref?]: New procedure.
[ref->refspecs]: New procedure.
Use them.
Change-Id: Ia2cb7db45222d59d61a2349bec277fd06456844b
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modified-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
052fab5f0b
commit
6e12325bf3
1 changed files with 13 additions and 9 deletions
20
guix/git.scm
20
guix/git.scm
|
@ -5,7 +5,7 @@
|
|||
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
|
||||
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
|
||||
;;; Copyright © 2023 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
|
||||
;;; Copyright © 2023, 2025 Simon Tournier <zimon.toutoune@gmail.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -575,9 +575,15 @@ current settings unchanged."
|
|||
(string-append "origin/" branch))))
|
||||
(_ ref)))
|
||||
|
||||
(define symref-list
|
||||
(match ref
|
||||
(('symref . symref) (list symref))
|
||||
(define symref?
|
||||
(match-lambda
|
||||
(('symref . _) #t)
|
||||
(_ #f)))
|
||||
|
||||
(define ref->refspecs
|
||||
(match-lambda
|
||||
(('symref . symref)
|
||||
(list (string-append "+" symref ":" symref)))
|
||||
(_ '())))
|
||||
|
||||
(with-libgit2
|
||||
|
@ -595,7 +601,7 @@ current settings unchanged."
|
|||
|
||||
;; When using symrefs, fetch remote again even if it has been cloned just
|
||||
;; before as the requested reference are not fetched when cloning.
|
||||
(when (and cache-exists?
|
||||
(when (and (or cache-exists? (symref? ref))
|
||||
(not (reference-available? repository ref)))
|
||||
(remote-fetch (remote-lookup repository "origin")
|
||||
#:fetch-options (make-default-fetch-options
|
||||
|
@ -603,9 +609,7 @@ current settings unchanged."
|
|||
verify-certificate?)
|
||||
;; Build refspecs from symbolic references so they are
|
||||
;; created locally and updated if necessary.
|
||||
#:refspecs (map (lambda (ref)
|
||||
(string-append "+" ref ":" ref))
|
||||
symref-list)))
|
||||
#:refspecs (ref->refspecs ref)))
|
||||
(when recursive?
|
||||
(update-submodules repository #:log-port log-port
|
||||
#:fetch-options
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue