diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2014-03-17 13:57:04 +0000 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2014-03-17 13:57:04 +0000 |
commit | fe5c6355cee196253ffd41c36df0064e8fb6d0cc (patch) | |
tree | f0a25f10c7b16a61b12d23c28b91130beaec4f71 | |
parent | 3a76819392eaee1fb20d6c68fd9fcf8a9d5d91fd (diff) | |
download | gall-fe5c6355cee196253ffd41c36df0064e8fb6d0cc.tar.gz |
Cope with the fact that the updated git can pack refs differently
-rw-r--r-- | lib/gall/repository.lua | 10 |
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 |