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.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gall/repository.lua b/lib/gall/repository.lua
index 65e4a42..70f74e5 100644
--- a/lib/gall/repository.lua
+++ b/lib/gall/repository.lua
@@ -226,8 +226,18 @@ if ll.git2 then
if get_all then
return old_merge_base(self, sha_1, sha_2, get_all)
end
- local oid_1 = ll.git2.OID.hex(sha_1)
- local oid_2 = ll.git2.OID.hex(sha_2)
+ local commitish_1 = self:get(sha_1)
+ local commitish_2 = self:get(sha_2)
+ pcall(function()
+ if commitish_1.type == "tag" then
+ commitish_1 = commitish_1.content.object
+ end
+ if commitish_2.type == "tag" then
+ commitish_2 = commitish_2.content.object
+ end
+ end)
+ local oid_1 = ll.git2.OID.hex(commitish_1.sha)
+ local oid_2 = ll.git2.OID.hex(commitish_2.sha)
local oid_base, err = ll.git2.merge.base(self.git2.repo, oid_1, oid_2)
if not oid_base then
if tostring(err) == "ENOTFOUND" then