2024-09-13 09:46:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get the current branch name
|
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
|
|
|
|
# get the latest commit hashes from origin and local
|
|
|
|
git fetch origin
|
|
|
|
LOCAL=$(git rev-parse HEAD)
|
|
|
|
REMOTE=$(git rev-parse origin/$BRANCH)
|
|
|
|
|
|
|
|
# check if the local branch differs from the remote branch
|
2024-09-13 13:20:07 +02:00
|
|
|
if [ "$LOCAL" != "$REMOTE" ]; then
|
2024-09-13 13:57:39 +02:00
|
|
|
echo "local $LOCAL differs from remote $REMOTE => pulling changes from origin"
|
2024-09-13 09:46:01 +02:00
|
|
|
git pull origin $BRANCH
|
|
|
|
|
|
|
|
# run the command
|
2024-09-13 13:19:29 +02:00
|
|
|
echo "Running ./gradlew test"
|
|
|
|
source .aliases # only variables, aliases are not expanded in scripts
|
|
|
|
./gradlew test
|
2024-09-13 09:46:01 +02:00
|
|
|
fi
|
|
|
|
|
2024-09-13 15:55:42 +02:00
|
|
|
# wait 10s with a little animation
|
|
|
|
echo -e -n " waiting for changes (/) ..."
|
|
|
|
sleep 2
|
|
|
|
echo -e -n "\r\033[K waiting for changes (-) ..."
|
|
|
|
sleep 2
|
|
|
|
echo -e -n "\r\033[K waiting for changes (\) ..."
|
|
|
|
sleep 2
|
|
|
|
echo -e -n "\r\033[K waiting for changes (|) ..."
|
|
|
|
sleep 2
|
|
|
|
echo -e -n "\r\033[K waiting for changes ( ) ... "
|
|
|
|
sleep 2
|
|
|
|
echo -e -n "\r\033[K"
|
2024-09-13 09:46:01 +02:00
|
|
|
done
|