diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-10 19:38:52 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-10 19:38:52 +0100 |
commit | ad7657999346a2c341aa9b6a500c027e86605554 (patch) | |
tree | 999143d172f4fb10500b4094c4186a98d61300f8 | |
parent | 886207393a0966d674d04efe950e80fb13a2160b (diff) | |
download | gall-ad7657999346a2c341aa9b6a500c027e86605554.tar.gz |
REPOSITORY: Support luagit2 for config calls
-rw-r--r-- | lib/gall/repository.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gall/repository.lua b/lib/gall/repository.lua index 7c4dc81..3a4bb75 100644 --- a/lib/gall/repository.lua +++ b/lib/gall/repository.lua @@ -276,6 +276,27 @@ function repomethod:config(confname, value) end end +if ll.git2 then + local old_config = repomethod.config + function repomethod:config(confname, value) + local conf = ll.git2.Config.open(self.path .. "/config" ) + if not conf then + return old_config(self, confname, value) + end + if not value then + local v = conf:get_string(confname) + return (v and true or nil), (v and v or "Unknown config: " .. confname) + else + if type(value) == "number" then + conf:set_int64(value) + else + conf:set_string(confname, tostring(value)) + end + return true + end + end +end + local repomt = { __index = repomethod, __tostring = _repotostring |