-- Turns object hashes and issue references in commit messages into links. -- Use it with the commit-filter or repo.commit-filter setting and the lua: -- prefix. cgit hands the filter the message already HTML-escaped, so this -- only wraps matches in anchors. local buffer function filter_open(...) buffer = "" end function filter_write(str) buffer = buffer .. str end function filter_close() -- Link a 7 to 64 character object name to this repository. local out = buffer:gsub("%f[%w](%x+)%f[%W]", function(hex) if #hex >= 7 and #hex <= 64 then return '' .. hex .. '' end end) -- Link "#123" to a bug tracker. Point this at your own. out = out:gsub("#(%d+)", '#%1') html(out) return 0 end