Fix git pull and remote hash retrieval in watch script

This commit is contained in:
Aaro Varis
2026-02-05 10:36:40 +02:00
parent f46bdd5470
commit 46cfaaff06

View File

@@ -1,5 +1,8 @@
#!/bin/bash
# Configuration
BRANCH="main" # Set your branch name here
# Function to get the current git commit hash
get_git_hash() {
git rev-parse HEAD 2>/dev/null
@@ -7,7 +10,7 @@ get_git_hash() {
# Function to start the application
start_app() {
git pull
git pull origin $BRANCH 2>/dev/null || true
source bin/activate
pip install -r requirements.txt
python init.py &
@@ -47,7 +50,7 @@ while true; do
git fetch origin 2>/dev/null
# Get the remote hash
REMOTE_HASH=$(git rev-parse origin/$(git rev-parse --abbrev-ref HEAD) 2>/dev/null)
REMOTE_HASH=$(git rev-parse origin/$BRANCH 2>/dev/null)
if [ "$CURRENT_HASH" != "$REMOTE_HASH" ]; then
echo "Git changes detected! Restarting..."