From fe5c6355cee196253ffd41c36df0064e8fb6d0cc Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Mon, 17 Mar 2014 13:57:04 +0000 Subject: Cope with the fact that the updated git can pack refs differently --- lib/gall/repository.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1