14 lines
811 B
Bash
14 lines
811 B
Bash
#!/usr/bin/env bash
|
|||
|
|
# Checks that the local `main` bookmark tracks `main@origin` (read-only). Without this tracking, jj refuses
|
||
|
|
# to push main ("Non-tracking remote bookmark"), and jjrelease would fail at the very end,
|
||
|
|
# after the tests and the version bump: this check detects it beforehand.
|
||
|
|
# Without a jj repository, without a `main` bookmark or without `main@origin`, there is nothing to check: success.
|
||
|
|
set -euo pipefail
|
||
|
|
. "$(dirname "$0")/common.sh"
|
||
|
|
|
||
|
|
rows=$(jj bookmark list main --all-remotes -T 'remote ++ "|" ++ tracked ++ "\n"' 2>/dev/null) || exit 0
|
||
|
|
if printf '%s\n' "$rows" | grep -qx 'origin|false'; then
|
||
|
|
err "✗ main@origin exists but the local main bookmark does not track it: the push of main would be refused"
|
||
|
|
info " Fix once and for all: jj bookmark track main@origin"
|
||
|
|
exit 1
|
||
|
|
fi
|