summaryrefslogtreecommitdiff
path: root/lib/gall/repository.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gall/repository.lua')
-rw-r--r--lib/gall/repository.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gall/repository.lua b/lib/gall/repository.lua
index 0e2c2d5..65e4a42 100644
--- a/lib/gall/repository.lua
+++ b/lib/gall/repository.lua
@@ -83,9 +83,17 @@ function repomethod:get_ref(ref)
end
if ll.git2 then
+ local orig_get_ref = repomethod.get_ref
function repomethod:get_ref(ref)
- local rref = ll.git2.Reference.lookup(self.git2.repo, ref)
+ local rref, msg = ll.git2.Reference.lookup(self.git2.repo, ref)
if not rref then
+ -- Our libgit2 code sometimes cannot cope with packed-refs
+ -- which contain peeled refs not in refs/tags/ so we try
+ -- again with the underlying git install if we get this
+ -- message
+ if msg == "The packed references file is corrupted" then
+ return orig_ret_ref(self, ref)
+ end
return nil
end
if rref:type() ~= ll.git2.REF_OID then