Updated on 2026-08-14
This commit is contained in:
parent
1133c53251
commit
d9dc6ce158
1 changed files with 5 additions and 4 deletions
|
|
@ -16,16 +16,17 @@ latest_merge_base=""
|
||||||
|
|
||||||
# Source refs to find branches from
|
# Source refs to find branches from
|
||||||
local_refs="refs/heads/releases/*" # For debug and development
|
local_refs="refs/heads/releases/*" # For debug and development
|
||||||
remote_refs=$(git for-each-ref --format="%(refname:short)" refs/remotes/origin/ | grep -E "origin/[a-zA-Z0-9._-]+_pre_release$")
|
remote_refs=$(git for-each-ref --sort=-committerdate --format="%(refname:short)" refs/remotes/origin/ | grep -E "origin/[a-zA-Z0-9._-]+_pre_release$")
|
||||||
|
|
||||||
# Iterate over all remote release branches sorted by commit date (most recent first)
|
# Iterate over all remote release branches sorted by commit date (most recent first)
|
||||||
for branch in $remote_refs; do
|
for branch in $remote_refs; do
|
||||||
|
# Find the common ancestor (merge base) between the base branch and the current branch
|
||||||
merge_base=$(git merge-base "$base_branch" "$branch")
|
merge_base=$(git merge-base "$base_branch" "$branch")
|
||||||
|
|
||||||
echo "Merge base for branches '$branch' and '$base_branch' is '$merge_base'"
|
echo "Merge base for branches '$branch' and '$base_branch' is '$merge_base'"
|
||||||
|
|
||||||
if [ -z "$latest_merge_base" ] || git rev-list "$merge_base..$base_branch" | grep -q .; then
|
# Update the latest branch and merge base if the current merge base is a descendant of the latest merge base
|
||||||
echo "Update"
|
if [ -z "$latest_merge_base" ] || git merge-base --is-ancestor "$latest_merge_base" "$merge_base"; then
|
||||||
latest_branch="$branch"
|
latest_branch="$branch"
|
||||||
latest_merge_base="$merge_base"
|
latest_merge_base="$merge_base"
|
||||||
fi
|
fi
|
||||||
|
|
@ -45,4 +46,4 @@ fi
|
||||||
latest_branch="${latest_branch#origin/}"
|
latest_branch="${latest_branch#origin/}"
|
||||||
|
|
||||||
echo "$latest_branch" > "find-latest-pre-release-branch.output"
|
echo "$latest_branch" > "find-latest-pre-release-branch.output"
|
||||||
echo "Latest release branch created directly from '$base_branch' or its ancestor: '$latest_branch'"
|
echo "Latest 'pre_release' branch created from '$base_branch' or its ancestor: '$latest_branch'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue