Add guard for git-sync-all for non-main branch

Only pull/push non-syncing repos (currently nixos and emacs) if on the
"main" branch, echo warning message and skip otherwise.
This commit is contained in:
Evie Litherland-Smith 2024-04-11 23:08:55 +01:00
parent 9d249bf6bb
commit 393843cf2e

View file

@ -46,8 +46,12 @@ for i in "${!PULL_DIRS[@]}"; do
fi fi
( (
cd "$DIRECTORY" || exit cd "$DIRECTORY" || exit
git remote set-url origin "$URL" if [ "$(git branch --show-current)" = "main" ]; then
git pull --ff-only git remote set-url origin "$URL"
git push git pull --ff-only
git push
else
echo "Not syncing repo $DIRECTORY on branch $(git branch --show-current)"
fi
) )
done done