43 lines
1.3 KiB
Bash
Executable File
43 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Opus v5.8 doctrine #7: WEVIA commits + dual push herself
|
|
cd /var/www/html
|
|
CHANGES=$(git status --short 2>/dev/null | wc -l)
|
|
LAST_COMMIT_BEFORE=$(git log --oneline -1 2>/dev/null | head -c 80)
|
|
|
|
if [ "$CHANGES" -gt 0 ]; then
|
|
git add -A 2>/dev/null
|
|
MSG="auto-sync via WEVIA git_sync_all intent $(date -Iseconds)"
|
|
git commit -m "$MSG" > /tmp/wc.log 2>&1
|
|
COMMIT_RESULT=$(tail -2 /tmp/wc.log | tr -d '\n' | head -c 200)
|
|
else
|
|
COMMIT_RESULT="no_changes_nothing_to_commit"
|
|
fi
|
|
|
|
# Push both
|
|
PO=$(git push origin main 2>&1 | tail -2 | tr -d '\n' | head -c 200)
|
|
PG=$(git push gitea main 2>&1 | tail -2 | tr -d '\n' | head -c 200)
|
|
|
|
# Sync status
|
|
ORIGIN_AB=$(git rev-list --left-right --count HEAD...origin/main 2>/dev/null)
|
|
GITEA_AB=$(git rev-list --left-right --count HEAD...gitea/main 2>/dev/null)
|
|
LAST_AFTER=$(git log --oneline -1 2>/dev/null | head -c 100)
|
|
|
|
cat <<EOF
|
|
{
|
|
"ok": true,
|
|
"v": "V5.8-git-sync-all-ZERO-MANUEL-opus-20avr",
|
|
"ts": "$(date -Iseconds)",
|
|
"doctrine": "#7 ZERO MANUEL - WEVIA handles git herself",
|
|
"changes_detected": $CHANGES,
|
|
"last_commit_before": "$LAST_COMMIT_BEFORE",
|
|
"commit_result": "$COMMIT_RESULT",
|
|
"push_origin": "$PO",
|
|
"push_gitea": "$PG",
|
|
"sync_status": {
|
|
"vs_origin_ahead_behind": "$ORIGIN_AB",
|
|
"vs_gitea_ahead_behind": "$GITEA_AB"
|
|
},
|
|
"last_commit_after": "$LAST_AFTER"
|
|
}
|
|
EOF
|