When preparing patches for Moodle I use the script in the docs to keep my GitHub repo up-to-date with upstream:
git fetch upstream
for BRANCH in MOODLE_{19..39}_STABLE master; do
git push origin refs/remotes/upstream/$BRANCH:refs/heads/$BRANCH
done
That's until I tried to add 3.10 which tried to update the 269 branches from MOODLE_40_STABLE to MOODLE_309_STABLE. Obviously Bash' integer brace expansion {19..310} won't cope with this change in the version numbering scheme.
I'm proposing changing this to:
git fetch upstream
branches=("19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" \
"30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "310")
branches=("${branches[@]/#/MOODLE_}")
branches=("${branches[@]/%/_STABLE}")
for BRANCH in "${branches[@]}" master; do
git push origin refs/remotes/upstream/$BRANCH:refs/heads/$BRANCH
done
I'm hoping for feedback on this before updating the script in the docs. It seems to do the job correctly but maybe someone has a better approach?