me
/
guix
Archived
1
0
Fork 0

git: 'reference-available?' handles short commit IDs.

Reported by Simon Tournier on #guix.

Until now 'reference-available?' would always return #f when passed a
short commit ID.

* guix/git.scm (reference-available?): Call 'object-lookup-prefix' when
COMMIT is shorter than 40 characters.
master
Ludovic Courtès 2020-12-04 18:43:04 +01:00
parent 611ae310f4
commit cde3a69a37
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 2 deletions

View File

@ -309,8 +309,12 @@ dynamic extent of EXP."
definitely available in REPOSITORY, false otherwise."
(match ref
(('commit . commit)
(false-if-git-not-found
(->bool (commit-lookup repository (string->oid commit)))))
(let ((len (string-length commit))
(oid (string->oid commit)))
(false-if-git-not-found
(->bool (if (< len 40)
(object-lookup-prefix repository oid len OBJ-COMMIT)
(commit-lookup repository oid))))))
(_
#f)))