diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-10 21:03:52 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-10 21:04:02 +0100 |
commit | 3e8a7386320303f4a78254445578bf23077dba1e (patch) | |
tree | 2e66d5ba03f12fa931ec53e04469e565a066ceaa | |
parent | ad7657999346a2c341aa9b6a500c027e86605554 (diff) | |
download | gall-3e8a7386320303f4a78254445578bf23077dba1e.tar.gz |
REPOSITORY: Support merge-base via luagit2
-rw-r--r-- | lib/gall/repository.lua | 19 | ||||
m--------- | luagit2 | 0 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/gall/repository.lua b/lib/gall/repository.lua index 3a4bb75..0e2c2d5 100644 --- a/lib/gall/repository.lua +++ b/lib/gall/repository.lua @@ -212,6 +212,25 @@ function repomethod:merge_base(sha_1, sha_2, get_all) return unpack(ret) end +if ll.git2 then + local old_merge_base = repomethod.merge_base + function repomethod:merge_base(sha_1, sha_2, get_all) + 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 oid_base, err = ll.git2.merge.base(self.git2.repo, oid_1, oid_2) + if not oid_base then + if tostring(err) == "ENOTFOUND" then + return true + end + return nil, err + end + return tostring(oid_base), err + end +end + function repomethod:rev_list(oldhead, newhead, firstonly) local args = { newhead, "^" .. oldhead } if firstonly then diff --git a/luagit2 b/luagit2 -Subproject 854e356e566e3c410781b3d0fac71aafd48e4cd +Subproject 8ad8200fd7e40095f152b4a3a44da12c8ee817d |