♻️ Let create:branch start from an ahead main
`create:finish` leaves the merge local until `create:release` pushes it, so `main` is routinely ahead of its upstream between a merge and a release. The branch front door demanded an exact match and refused until it was pushed, forcing a manual `git push` that the model deliberately keeps out of it. Reject only a `main` that is behind its upstream — matching `create:finish`, which already tolerates being ahead — and record why pushing from `finish` was rejected instead. The push stays with `create:release`, so the merge remains reviewable locally, and the known issue about the deadlock is gone. Resolves: backlog task "Resolve the finish/push tension".
This commit is contained in:
1 parent
177d63fa95
commit
d646fd1ec4
5 files changed
+21
-18
No files matched your search
+7
-5
@@ -86,12 +86,14 @@ if [ -n "${UPSTREAM}" ]; then
|
||||
echo " refusing to branch on a possibly stale '${BASE}'." >&2
|
||||
exit 1
|
||||
}
|
||||
# Only *behind* is a problem. `create:finish` deliberately leaves the local
|
||||
# merge on '${BASE}' until `create:release` pushes it, so being ahead is the
|
||||
# normal state between a merge and the release that ships it; branching from
|
||||
# those commits is intended. Missing remote commits is not.
|
||||
BEHIND=$(git rev-list --count "${BASE}..${UPSTREAM}")
|
||||
AHEAD=$(git rev-list --count "${UPSTREAM}..${BASE}")
|
||||
if [ "${BEHIND}" -ne 0 ] || [ "${AHEAD}" -ne 0 ]; then
|
||||
echo "error: '${BASE}' has diverged from '${UPSTREAM}' (ahead ${AHEAD}, behind ${BEHIND})." >&2
|
||||
[ "${AHEAD}" -ne 0 ] && echo " not yet pushed commits on '${BASE}': push them, or rebase this work onto them." >&2
|
||||
[ "${BEHIND}" -ne 0 ] && echo " update it: git switch ${BASE} && git pull --ff-only" >&2
|
||||
if [ "${BEHIND}" -ne 0 ]; then
|
||||
echo "error: '${BASE}' is behind '${UPSTREAM}' (by ${BEHIND})." >&2
|
||||
echo " update it: git switch ${BASE} && git pull --ff-only" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user