diff options
author | Richard Maw <richard.maw@gmail.com> | 2017-05-13 14:16:48 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2017-05-13 14:16:48 +0100 |
commit | 40e0442dd57b004e5024d52e0fe00ff835d493b3 (patch) | |
tree | 07c293eeb60aaef565341483d69480dd37869c62 | |
parent | 7acacb951b8a099b901b1f3b5e67f1d4c69cbfe3 (diff) | |
download | gall-40e0442dd57b004e5024d52e0fe00ff835d493b3.tar.gz |
gall.repository: Use revparse_single to normalise
This permits resolving files with REF:FILE syntax.
This removes the special-case for if it matches a normal refname,
since a "normal refname" isn't so easy to define as "starts refs/",
and it's approximately the same cost to parse a refname
as an arbitrary gitrevision as it is to parse a refname as a refname.
-rw-r--r-- | lib/gall/repository.lua | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/gall/repository.lua b/lib/gall/repository.lua index 57031ba..fc49576 100644 --- a/lib/gall/repository.lua +++ b/lib/gall/repository.lua @@ -23,8 +23,6 @@ local repomethod = {} local pattern = { fullsha = string.rep("[0-9a-f]", 40), - shortsha = string.rep("[0-9a-f]", 7), - ref = "refs/.+" } for k, v in pairs(pattern) do @@ -253,13 +251,10 @@ function repomethod:normalise(sha) -- Purpose is to take a 'shaish' object and normalise it if sha:match(pattern.fullsha) then return sha - elseif sha:match(pattern.ref) then - local ref, err = self:get_ref(sha) - return ref, err else local fullsha if ll.git2 then - local refobj = ll.git2.lookup_sha_from_ref(self.git2.repo, sha) + local refobj = ll.git2.revparse_single(self.git2.repo, sha) if refobj then fullsha = refobj end |