fix(crabbox): refresh stale changed-gate git metadata

This commit is contained in:
Vincent Koc
2026-06-18 19:16:29 +02:00
parent 361320cd9f
commit 7ef85bfb1d
2 changed files with 49 additions and 25 deletions

View File

@@ -1501,11 +1501,14 @@ function mergeBaseForChangedGate() {
function remoteGitBootstrapForChangedGate(changedGateBase) {
const quotedBase = shellQuote(changedGateBase);
return [
"if ! git status --short >/dev/null 2>&1; then",
"openclaw_changed_gate_base=${OPENCLAW_CHANGED_GATE_BASE:-" + quotedBase + "};",
'if ! command -v git >/dev/null 2>&1; then echo "git is required for OpenClaw remote changed-gate sync" >&2; exit 2; fi;',
'openclaw_changed_gate_remote_base="$(git rev-parse --verify refs/remotes/origin/main 2>/dev/null || true)";',
'if ! git status --short >/dev/null 2>&1 || [ "$openclaw_changed_gate_remote_base" != "$openclaw_changed_gate_base" ]; then',
"rm -rf .git;",
"git init -q;",
"git remote add origin https://github.com/openclaw/openclaw.git 2>/dev/null || git remote set-url origin https://github.com/openclaw/openclaw.git;",
`git fetch -q --depth=1 origin ${quotedBase}:refs/remotes/origin/main;`,
'git fetch -q --depth=1 origin "$openclaw_changed_gate_base:refs/remotes/origin/main";',
"git reset --mixed --quiet refs/remotes/origin/main;",
"git add -A;",
"if ! git diff --cached --quiet; then git -c user.name=OpenClaw -c user.email=ci@openclaw.local commit -q --no-gpg-sign -m remote-changed-gate-tree; fi;",