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.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gall/commit.lua b/lib/gall/commit.lua
index ce1d375..b87904e 100644
--- a/lib/gall/commit.lua
+++ b/lib/gall/commit.lua
@@ -69,6 +69,7 @@ end
local function commitindex(commit, field)
if not parsed[commit] then
local raw = objs[commit].raw
+ local sigcert = {}
local headers, body, signature = {}, ""
local state = "headers"
@@ -80,6 +81,7 @@ local function commitindex(commit, field)
signature = second .. "\n"
state = "signature"
else
+ sigcert[#sigcert+1] = l
if headers[first] then
headers[first][#headers[first]+1] = second
else
@@ -88,6 +90,7 @@ local function commitindex(commit, field)
end
else
state = "message"
+ sigcert[#sigcert+1] = l
end
elseif state == "signature" then
signature = signature .. l:sub(2) .. "\n"
@@ -98,6 +101,7 @@ local function commitindex(commit, field)
body = body .. l .. "\n"
end
end
+ sigcert[#sigcert+1] = body
-- there's always one tree
rawset(commit, "tree", repos[commit]:get(headers.tree[1]))
@@ -112,6 +116,8 @@ local function commitindex(commit, field)
rawset(commit, "message", body)
-- And an optional signature
rawset(commit, "signature", signature)
+ -- The optional signature has to sign something
+ rawset(commit, "signedcert", table.concat(sigcert, "\n"))
-- Promote the SHA
rawset(commit, "sha", objs[commit].sha)
@@ -163,6 +169,11 @@ end
-- @field signature
---
+-- The certificate which the signature (if present) signs
+--
+-- @field signedcert
+
+---
-- The SHA1 OID of the commit
--
-- @field sha