summaryrefslogtreecommitdiff
path: root/lib/gall/commit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gall/commit.lua')
-rw-r--r--lib/gall/commit.lua27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/gall/commit.lua b/lib/gall/commit.lua
index 92afff8..080c7ed 100644
--- a/lib/gall/commit.lua
+++ b/lib/gall/commit.lua
@@ -42,23 +42,26 @@ local function commitindex(commit, field)
if state == "headers" then
local first, second = l:match("^([^ ]+) (.+)$")
if first then
- if headers[first] then
- headers[first][#headers[first]+1] = second
+ if first == "gpgsig" then
+ signature = second .. "\n"
+ state = "signature"
else
- headers[first] = { second }
+ if headers[first] then
+ headers[first][#headers[first]+1] = second
+ else
+ headers[first] = { second }
+ end
end
else
state = "message"
end
- elseif state == "message" then
- if l == PGP_SIG_START then
- signature = l .. "\n"
- state = "signature"
- else
- body = body .. l .. "\n"
+ elseif state == "signature" then
+ signature = signature .. l:sub(2) .. "\n"
+ if l:find("END PGP SIG") then
+ state = "headers"
end
else
- signature = signature .. l .. "\n"
+ body = body .. l .. "\n"
end
end
@@ -94,14 +97,14 @@ local commitmeta = {
__tostring = committostring
}
-function _new(repo, obj)
+local function _new(repo, obj)
local ret = setmetatable({}, commitmeta)
objs[ret] = obj
repos[ret] = repo
return ret
end
-function _create(repo, data)
+local function _create(repo, data)
if not data.tree then
return nil, "No tree?"
end