Fix provision-ringtail ls-remote matching with mirror refs

git ls-remote returns multiple lines when a mirror ref exists
(e.g. refs/remotes/remote_mirror_*/main). Take only the first
line to avoid a false mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-02-18 21:22:46 -08:00
commit 1f2134bf0a

View file

@ -17,7 +17,7 @@ if ! git diff --quiet nixos/ringtail/flake.lock; then
fi fi
COMMIT=$(git rev-parse HEAD) COMMIT=$(git rev-parse HEAD)
REMOTE_REF=$(git ls-remote origin "$(git rev-parse --abbrev-ref HEAD)" 2>/dev/null | awk '{print $1}') REMOTE_REF=$(git ls-remote origin "$(git rev-parse --abbrev-ref HEAD)" 2>/dev/null | awk 'NR==1{print $1}')
if [[ "$REMOTE_REF" != "$COMMIT" ]]; then if [[ "$REMOTE_REF" != "$COMMIT" ]]; then
echo "ERROR: Current commit $COMMIT is not pushed to forge." echo "ERROR: Current commit $COMMIT is not pushed to forge."