The gemini-code-assist bug found a couple of real issues when the Lua script was imported here: https://github.com/konflux-ci/rpmbuild-pipeline-environment-container/pull/105
Specifically, these findings are valid.
Duplicate break
if not l then break -- No longer the commit message. break end
Duplicate patchgit_version check
if patchgit_version and patchgit_version and release_known and changelog_known then start_commit = i break end
Incorrect character class
function git_date_to_rpm_date(s) local wd, mon, d, y = string.match( s, '^([A-z][a-z][a-z]) ([A-Z][a-z][a-z]) (%d+) %d%d:%d%d:%d%d (%d+)') assert(y, s) local m = assert(months[mon], s) local rpmdate = string.format('%s %s %02d %04d', wd, mon, d, y) local ymd = string.format('%04d-%02d-%02d', y, m, d) return rpmdate, ymd end
[A-z] really should be [A-Z]. Indentation should be fixed as well.
Incorrect variable reference
local failure
for _, cmd in ipairs(test_commands) do
cmd = 'lua patch-git.lua ' .. cmd
print('* ' .. cmd)
local ok, term, status = os.execute(cmd)
if not ok or term ~= 'exit' or status ~= 0 then
failure = true
print('FAIL: term=' .. term .. ', status=' .. status)
end
end
if fail then
os.exit(1)
end
Should be failure in the last if.