Accept short git revs

Short revisions are fine, SHA1 is broken anyway.
This commit is contained in:
Ehmry - 2023-10-31 15:36:57 +00:00
parent a904a4630c
commit 222aea9e79
1 changed files with 3 additions and 5 deletions

View File

@ -64,8 +64,8 @@ proc gitLsRemote(url: string; withTags: bool): seq[tuple[tag: string, rev: strin
proc matchRev(url: string; wanted: VersionRange): tuple[tag: string, rev: string] =
if wanted.kind == verSpecial:
let special = string(wanted.spe)
if special.len == 41 and special[0] == '#':
result[1] = special[1..39]
if special[0] == '#':
result[1] = special[1..special.high]
else:
quit("unhandled version " & url & " " & $wanted)
else:
@ -120,9 +120,7 @@ proc prefetchGit(uri: Uri; version: VersionRange): Preserve =
var archiveUri = uri
archiveUri.scheme = "https"
archiveUri.path.removeSuffix ".git"
archiveUri.path.add "/archive/"
archiveUri.path.add rev
archiveUri.path.add ".tar.gz"
archiveUri.path = archiveUri.path / "archive"/ rev & ".tar.gz"
let client = newHttpClient()
defer: close(client)
let