diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-08 16:18:07 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-09-08 16:18:07 +0100 |
commit | 3d14a3b8dfae2410778031ea55cce58a706fae33 (patch) | |
tree | 935f12b1cba16b15c45a0712334b3e2aee4f2ad4 /lib | |
parent | ea949ae3bb60172aa6cf84680dff308df13686e7 (diff) | |
download | gall-3d14a3b8dfae2410778031ea55cce58a706fae33.tar.gz |
GALL.COMMIT: Test gall.commit (except creation of commits)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gall/commit.lua | 27 |
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 |