summaryrefslogtreecommitdiff
path: root/guix/git-download.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
commit030f6f489fe9544f35ebaf95135acd1dd67ce63f (patch)
treef1d5d1f1b68de81daec6f05d032a0410a475d960 /guix/git-download.scm
parent95c14929a7fbd3c55c5e8756953c2f257625e2b7 (diff)
parent938df0de739aa13c2fb483f440ec1db281a52aaa (diff)
downloadguix-patches-030f6f489fe9544f35ebaf95135acd1dd67ce63f.tar
guix-patches-030f6f489fe9544f35ebaf95135acd1dd67ce63f.tar.gz
Merge branch 'master' into core-updates
Conflicts: etc/news.scm gnu/local.mk gnu/packages/bootloaders.scm gnu/packages/linphone.scm gnu/packages/linux.scm gnu/packages/tls.scm gnu/system.scm
Diffstat (limited to 'guix/git-download.scm')
-rw-r--r--guix/git-download.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/git-download.scm b/guix/git-download.scm
index 1eae035fc4..ef0bb2e281 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -30,6 +31,8 @@
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-34)
+ #:use-module (srfi srfi-35)
#:export (git-reference
git-reference?
git-reference-url
@@ -170,6 +173,13 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
(define (git-version version revision commit)
"Return the version string for packages using git-download."
+ ;; git-version is almost exclusively executed while modules are being loaded.
+ ;; This makes any errors hide their backtrace. Avoid the mysterious error
+ ;; "Value out of range 0 to N: 7" when the commit ID is too short, which
+ ;; can happen, for example, when the user swapped the revision and commit
+ ;; arguments by mistake.
+ (when (< (string-length commit) 7)
+ (error "git-version: commit ID unexpectedly short"))
(string-append version "-" revision "." (string-take commit 7)))
(define (git-file-name name version)