summaryrefslogtreecommitdiff
path: root/guix/git.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-26 11:16:10 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-26 11:21:36 +0200
commit10a8c2bbc6754bddb0e5d668b3ecc9050efd820b (patch)
treea858fad2771128017dbf531cc35b1af72c77976d /guix/git.scm
parent177fecb57c0c9e15249bf6a49244c9dc6eb8439c (diff)
git: 'switch-to-ref' resolves tag targets.
* guix/git.scm (switch-to-ref): In the 'tag' case, resolve the target of the tag. * tests/guix-build-branch.sh: Adjust test accordingly.
Diffstat (limited to 'guix/git.scm')
-rw-r--r--guix/git.scm6
1 files changed, 5 insertions, 1 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 85252629fc..de98fed40c 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -172,7 +172,11 @@ OID (roughly the commit hash) corresponding to REF."
(('tag . tag)
(let ((oid (reference-name->oid repository
(string-append "refs/tags/" tag))))
- (object-lookup repository oid))))))
+ ;; Get the commit that the tag at OID refers to. This is not
+ ;; strictly needed, but it's more consistent to always return the
+ ;; OID of a commit.
+ (object-lookup repository
+ (tag-target-id (tag-lookup repository oid))))))))
(reset repository obj RESET_HARD)
(object-id obj))