aboutsummaryrefslogtreecommitdiff
path: root/guix/git.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-03-31 23:17:29 +0200
committerLudovic Courtès <ludo@gnu.org>2024-04-15 22:36:41 +0200
commit088e181c0a58bf1a03e3aa7be1202fb3cd209136 (patch)
tree81358e01f07abf103e7a5692ca4c24fedc831f8d /guix/git.scm
parenta57518484e5437b29496e1c132c6566e1eb437e8 (diff)
downloadguix-088e181c0a58bf1a03e3aa7be1202fb3cd209136.tar
guix-088e181c0a58bf1a03e3aa7be1202fb3cd209136.tar.gz
channels: Move ‘commit-short-id’ to (guix git).
* guix/channels.scm (commit-short-id): Move to… * guix/git.scm (commit-short-id): … here. Change-Id: If4b34b1d82b1aa5068d157f26e57e8aecc967061
Diffstat (limited to 'guix/git.scm')
-rw-r--r--guix/git.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 760b064a9c..eab84ea798 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -67,6 +67,7 @@
commit-relation
commit-descendant?
commit-id?
+ commit-short-id
remote-refs
@@ -233,6 +234,9 @@ 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 commit-short-id
+ (compose (cut string-take <> 7) oid->string commit-id))
+
(define (resolve-reference repository ref)
"Resolve the branch, commit or tag specified by REF, and return the
corresponding Git object."