git pull: replace reset --hard + clean -fd with --ff-only
This commit is contained in:
+5
-9
@@ -208,19 +208,15 @@ else
|
||||
# Uses conf files already present from last pull to determine exclusions
|
||||
configure_sparse_checkout "$TARGET_DIR"
|
||||
|
||||
log "git reset --hard"
|
||||
git reset --hard
|
||||
|
||||
log "git clean -fd"
|
||||
git clean -fd
|
||||
|
||||
echo " Pulling latest changes..."
|
||||
if GIT_SSH_COMMAND="ssh -i $GITEA_SSH_KEY -p $SSH_PORT" git pull; then
|
||||
if GIT_SSH_COMMAND="ssh -i $GITEA_SSH_KEY -p $SSH_PORT" git pull --ff-only; then
|
||||
echo " Git pull successful"
|
||||
SYNC_SUCCESS=true
|
||||
else
|
||||
error "Git pull failed"
|
||||
notify "Git pull failed on $(hostname) — check Gitea connectivity" "Git Sync" "alert"
|
||||
# ff-only fails when local commits or tracked changes exist that can't
|
||||
# fast-forward. Fail loudly — never silently destroy local work.
|
||||
error "Git pull failed — local changes conflict with remote (will not force-reset)"
|
||||
notify "Git pull failed on $(hostname) — local changes conflict, manual resolve needed" "Git Sync" "alert"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user