Commit 6e8f7ba2 authored by Michal Sojka's avatar Michal Sojka

Push to remote repos in parallel

Pushing sequentially is unnecessarily slow.
parent bdf4ddca
......@@ -78,6 +78,19 @@ handle_commit() {
done
}
push() {
local branch=${1:?}
local url=${2:?}
if [[ "$url" ]]; then
echo "ae-sync: Pushing AE $branch to $url"
git push -f --quiet "$url" "$branch":master
else
echo "ae-sync: Not pushing AE to BRUTE because url for $branch is not configured in .brutegit-ae-sync"
fi
}
export -f push # Export for GNU parallel
if [ "$1" ]; then
if [ "$1" = "--push" ]; then
for branch in $(get_ae_branches master); do
......@@ -107,14 +120,10 @@ else
if [ "${old_hash[$branch]}" != "$(git rev-parse --verify --quiet refs/heads/"$branch")" ]; then
new_ae_commit=1
url=$(git config --blob "${commit}:.brutegit-ae-sync" --get "$branch".url || :)
if [[ "$url" ]]; then
echo "ae-sync: Pushing AE $branch to $url"
git push -f --quiet "$url" "$branch":master
else
echo "ae-sync: Not pushing AE to BRUTE because url for $branch is not configured in .brutegit-ae-sync"
fi
echo "$branch $url" # output arguments for parallel
fi
done
done | parallel -j0 --colsep ' ' push
if [[ -z "$new_ae_commit" ]]; then
echo "ae-sync: No AE updates detected"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment