git: <git-checkout> allows tags in its 'commit' field.

Fixes <https://bugs.gnu.org/36371>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

* guix/git.scm (git-checkout-compiler): Pass 'tag-or-commit' to
'latest-repository-commit*'.
* doc/guix.texi (Package Transformation Options): Update '--with-commit'
documentation accordingly.
* tests/guix-build-branch.sh: Add test.
This commit is contained in:
Ludovic Courtès 2019-07-26 11:09:56 +02:00
parent c4c2449fea
commit 177fecb57c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 10 additions and 4 deletions

View File

@ -8048,7 +8048,7 @@ guix build --with-branch=guile-sqlite3=master cuirass
@item --with-commit=@var{package}=@var{commit} @item --with-commit=@var{package}=@var{commit}
This is similar to @code{--with-branch}, except that it builds from This is similar to @code{--with-branch}, except that it builds from
@var{commit} rather than the tip of a branch. @var{commit} must be a valid @var{commit} rather than the tip of a branch. @var{commit} must be a valid
Git commit SHA1 identifier. Git commit SHA1 identifier or a tag.
@end table @end table
@node Additional Build Options @node Additional Build Options

View File

@ -330,7 +330,7 @@ Log progress and checkout info to LOG-PORT."
git-checkout? git-checkout?
(url git-checkout-url) (url git-checkout-url)
(branch git-checkout-branch (default "master")) (branch git-checkout-branch (default "master"))
(commit git-checkout-commit (default #f)) (commit git-checkout-commit (default #f)) ;#f | tag | commit
(recursive? git-checkout-recursive? (default #f))) (recursive? git-checkout-recursive? (default #f)))
(define* (latest-repository-commit* url #:key ref recursive? log-port) (define* (latest-repository-commit* url #:key ref recursive? log-port)
@ -369,7 +369,7 @@ Log progress and checkout info to LOG-PORT."
(($ <git-checkout> url branch commit recursive?) (($ <git-checkout> url branch commit recursive?)
(latest-repository-commit* url (latest-repository-commit* url
#:ref (if commit #:ref (if commit
`(commit . ,commit) `(tag-or-commit . ,commit)
`(branch . ,branch)) `(branch . ,branch))
#:recursive? recursive? #:recursive? recursive?
#:log-port (current-error-port))))) #:log-port (current-error-port)))))

View File

@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU # GNU Guix --- Functional package management for GNU
# Copyright © 2018 Ludovic Courtès <ludo@gnu.org> # Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
# #
# This file is part of GNU Guix. # This file is part of GNU Guix.
# #
@ -52,5 +52,11 @@ guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-git.9e3eacd
test "$v0_1_0_drv" != "$latest_drv" test "$v0_1_0_drv" != "$latest_drv"
test "$v0_1_0_drv" != "$orig_drv" test "$v0_1_0_drv" != "$orig_drv"
v0_1_0_drv="`guix build guix --with-commit=guile-gcrypt=v0.1.0 -d`"
guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-git.v0.1.0
guix gc -R "$v0_1_0_drv" | grep guile-gcrypt-8fe64e8 # this is the *tag* ID
test "$v0_1_0_drv" != "$latest_drv"
test "$v0_1_0_drv" != "$orig_drv"
if guix build guix --with-commit=guile-gcrypt=000 -d if guix build guix --with-commit=guile-gcrypt=000 -d
then false; else true; fi then false; else true; fi