Allow delete branch if eol tag is not at HEAD

In some cases [1] <series>-eol tag exists but it is not on the last
patch of a branch and we still need to delete them. Originally the
script skips these cases and doesn't allow to delete the branch. This
patch makes it possible to delete the branch anyway (only when the tag
exists!).

[1] for example when:
    * patches were merged after EOL tagging
    * branch was accidently recreated with new patches

Change-Id: If9491ddb292e2eebcc4c713140ce02c2d89c80a3
This commit is contained in:
Előd Illés 2022-12-14 20:43:18 +01:00
parent c73a4dd0d7
commit 2483ee6b7d

View File

@ -80,7 +80,22 @@ function eol_tag_matches_head {
[[ "$head" =~ "${em_branch}-eol" ]] && [[ "$head" =~ "origin/stable/${em_branch}" ]]
matches=$?
if [[ "$matches" -eq 1 ]] ; then
echo "stable/${em_branch} has patches on top of the ${em_branch}-eol tag"
tags=$(git tag)
[[ "$tags" =~ "${em_branch}-eol" ]]
eol_tag_exists=$?
if [[ "$eol_tag_exists" -eq 0 ]]; then
echo "WARNING !!! stable/${em_branch} has patches on top of the ${em_branch}-eol tag."
echo "Please check the branch and ${em_branch}-eol tag manually."
echo "Do not delete the branch if you are not sure!"
read -p "> If you are sure the branch can be deleted, then press D + Enter: " DELETE
if [ "${DELETE,,}" == "d" ]; then
matches=0
else
echo "Skipping."
fi
else
echo "No ${em_branch}-eol tag found! Branch cannot be deleted. Skipping."
fi
fi
return $matches
}