From 514a503d8c39e13acc9780936e003d3198a54793 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 17 Sep 2025 11:14:25 +0300 Subject: [PATCH] Add check for .git dir --- config.yaml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/config.yaml b/config.yaml index 9e84c52..8a82e03 100644 --- a/config.yaml +++ b/config.yaml @@ -14,27 +14,31 @@ actions: or (posix.access('/usr/bin/git', 'x') and posix.access(sourcedir .. '/.git/.', 'x'))) local commit_marker_contents -- For git_commit_file. + if have_git then + commit_marker_contents = replace: | local have_git = (posix == nil -- Not running under rpm. 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]+)') - 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 + 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 = count: 1 - target: "patch-git.lua" find: |