summaryrefslogtreecommitdiff
path: root/guix/git.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-10-12 14:33:56 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-10-12 14:36:44 +0300
commit322917aeb8e672c21378fd371a5cff4a9f0c2520 (patch)
tree70229faa39f14caa09b769153453c3898f64f7fc /guix/git.scm
parent407f017663c97ebfe48e3cb304bf97bf2557f83f (diff)
parente1baf802ccd8af4f7b416b0987db706f2dbfc42f (diff)
Merge remote-tracking branch 'origin/master' into staging
Conflicts: gnu/packages/gnuzilla.scm gnu/packages/graphics.scm gnu/packages/gstreamer.scm gnu/packages/gtk.scm gnu/packages/kde-frameworks.scm gnu/packages/video.scm
Diffstat (limited to 'guix/git.scm')
-rw-r--r--guix/git.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 53e7219c8c..d7fd320f50 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -62,6 +62,7 @@
commit-difference
commit-relation
commit-descendant?
+ commit-id?
remote-refs
@@ -219,6 +220,12 @@ of SHA1 string."
(last (string-split url #\/)) ".git" "")
"-" (string-take sha1 7)))
+(define (commit-id? str)
+ "Return true if STR is likely a Git commit ID, false otherwise---e.g., if it
+is a tag name. This is based on a simple heuristic so use with care!"
+ (and (= (string-length str) 40)
+ (string-every char-set:hex-digit str)))
+
(define (resolve-reference repository ref)
"Resolve the branch, commit or tag specified by REF, and return the
corresponding Git object."
@@ -254,8 +261,7 @@ corresponding Git object."
#f))
(_ #f)))
=> (lambda (commit) (resolve `(commit . ,commit))))
- ((or (> (string-length str) 40)
- (not (string-every char-set:hex-digit str)))
+ ((not (commit-id? str))
(resolve `(tag . ,str))) ;definitely a tag
(else
(catch 'git-error