Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: changed branch names in bin/check-component-branch-rebase.sh #96

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions bin/check-component-branch-rebase.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# The script checks if the branches ending with '-TDP' have been rebased on their corresponding '-build' branch in each component's repository.
# The script checks if the branches ending with '-fix' have been rebased on their corresponding '-basic' branch in each component's repository.

# Go to the folder which contains all theses repositories and execute this script.

Expand Down Expand Up @@ -29,28 +29,28 @@ check_branches() {
git fetch origin

# Initialize an empty array
build_branches=()
basic_branches=()

# Read each line of the command output into the array
while IFS= read -r branch; do
# Append each branch to the array
build_branches+=("$branch")
done < <(git branch -r --list 'origin/*-build')
basic_branches+=("$branch")
done < <(git branch -r --list 'origin/*-basic')

# Check if the array is empty
if [ ${#build_branches[@]} -eq 0 ]; then
echo "No branches matching the pattern 'origin/*-build' found."
if [ ${#basic_branches[@]} -eq 0 ]; then
echo "No branches matching the pattern 'origin/*-basic' found."
else
# Loop through each branch in the array
for ((i=0; i<${#build_branches[@]}; i++)); do
# Replace "-build" with "-TDP" for each branch
tdp_branch=${build_branches[i]/-build/-TDP}
echo "Build branch: ${build_branches[i]}"
# Check if TDP branch contains the build branch
if git merge-base --is-ancestor ${build_branches[i]} $tdp_branch; then
echo "Branch -TDP is based on -build branch"
for ((i=0; i<${#basic_branches[@]}; i++)); do
# Replace "-basic" with "-fix" for each branch
fix_branch=${basic_branches[i]/-basic/-fix}
echo "Basic branch: ${basic_branches[i]}"
# Check if fix branch contains the basic branch
if git merge-base --is-ancestor ${basic_branches[i]} $fix_branch; then
echo "Branch -fix is based on -basic branch"
else
echo "Error: Branch -TDP is not based on -build branch"
echo "Error: Branch -fix is not based on -basic branch"
fi
done
fi
Expand Down