Do not offer to promote work that already landed
All checks were successful
CI / naming (push) Successful in 4s
CI / frontend (push) Successful in 12s
CI / migrations-mysql (push) Successful in 41s
CI / backend (push) Successful in 4m4s

Promotion cherry-picks, which gives the commit a new sha on main. wj-status
compared by sha via main..wj, so after promoting ten commits it still listed all
ten as unpromoted - and would have invited promoting the same work twice.

git cherry compares patch content instead and marks an already-present commit
with a leading '-'. When nothing is genuinely outstanding it now says so, counts
what has already landed, and shows how far the branch is BEHIND main with the
rebase to run. Behind was the state that mattered here and the tool could not
express it at all.

Scope: product
This commit is contained in:
cproudlock
2026-08-30 12:48:56 -04:00
parent 1c88acad3c
commit faace01f2d

View File

@@ -44,10 +44,25 @@ if ! git rev-parse --verify --quiet refs/heads/wj >/dev/null; then
exit 1
fi
COMMITS="$(git rev-list --reverse "$RANGE")"
# git cherry, not rev-list. Promotion CHERRY-PICKS, which gives the commit a new
# sha on main, so `main..wj` keeps listing work that already landed - and this
# tool would then invite you to promote it a second time. `git cherry` compares
# patch content and marks an already-present commit with a leading '-'.
COMMITS="$(git cherry main wj | awk '$1 == "+" { print $2 }')"
ALREADY="$(git cherry main wj | awk '$1 == "-" { print $2 }' | wc -l)"
if [ -z "$COMMITS" ]; then
echo "Nothing on wj that main does not have."
if [ "$ALREADY" -gt 0 ]; then
echo "($ALREADY commit(s) here have already landed on main as cherry-picks.)"
fi
echo
echo "wj is behind main by:"
git log --oneline wj..main | sed 's/^/ /' | head -10
echo
echo "Rebase it before starting new work:"
echo " git checkout wj && git rebase main"
exit 0
fi