diff --git a/patch-git.lua b/patch-git.lua index 8c6ec24..5a46d53 100644 --- a/patch-git.lua +++ b/patch-git.lua @@ -358,25 +358,25 @@ local function generate_files() or (posix.access('/usr/bin/git', 'x') and posix.access(sourcedir .. '/.git/.', 'x'))) local commit_marker_contents -- For git_commit_file. - -- If the branch/tag is AlmaLinux, then we need to get history of Upstream -- branch/tag, and skip all AlmaLinux-specific commits. To avoid duplicates -- in changelog and bumped release numbers - local log_branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)') or 'HEAD' - local anum = string.match(log_branch, '^a(%d+s?)$') - if anum then - log_branch = 'c' .. anum - else - log_branch = string.match(run_git('describe --tags --exact-match'), '([^\n]+)') - local anum, aname = string.match(log_branch, '^changed/a(%d+s?)/(.+)$') - if anum then - local cname = string.gsub(aname, '%.alma%.[0-9]+$', '') - log_branch = 'imports/c' .. anum .. '/' .. cname - end - end + local log_branch = 'HEAD' if have_git then - commit_marker_contents = - run_git('rev-parse ' .. log_branch) .. 'v' .. VERSION .. '\n' + log_branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)') + local anum = string.match(log_branch, '^a(%d+s?)$') + if anum then + log_branch = 'c' .. anum + else + log_branch = string.match(run_git('describe --tags --exact-match'), '([^\n]+)') + local anum, aname = string.match(log_branch, '^changed/a(%d+s?)/(.+)$') + if anum then + local cname = string.gsub(aname, '%.alma%.[0-9]+$', '') + log_branch = 'imports/c' .. anum .. '/' .. cname + end + end + commit_marker_contents = + run_git('rev-parse ' .. log_branch) .. 'v' .. VERSION .. '\n' if commit_marker_contents == read_source_file(git_commit_file) then -- HEAD and version did not change. No file generation return