Skip to content

Commit

Permalink
refactor: changed branch names in bin/check-component-branch-rebase.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
SteBaum committed Mar 14, 2024
1 parent 66e1927 commit 0631f12
Showing 1 changed file with 14 additions and 14 deletions.
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

0 comments on commit 0631f12

Please sign in to comment.