fix(tools/git): -h/--help now exits 0 across 7 wrappers #702
Reference in New Issue
Block a user
Delete Branch "fix/701-git-wrapper-help-exit-code"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
usage() in issue-assign.sh, issue-create.sh, issue-list.sh,
milestone-create.sh, pr-create.sh, pr-list.sh, and pr-merge.sh
hard-coded exit 1, so every -h/--help invocation printed help but
exited nonzero — logging phantom isError:true records fleet-wide and
breaking set -e composition in callers.
Fix (per #701's proposed fix): usage() now takes an exit-code
argument defaulting to 1; each wrapper's -h|--help case calls
usage 0 so help exits cleanly. All other invocations of usage()
(unknown option, missing required arg) are unchanged and still
default to exit 1.
Scope: help/exit-code handling only. No merge, approval, auth, or
gate-enforcement logic was touched — verified via
git diff --stat(exactly 2 lines changed per file, 14 total) and confirmed by reading
the full diff of pr-merge.sh (squash-only enforcement, base-branch
check, CI queue-guard invocation, tea/API merge fallback all
untouched).
lane-brief.sh is intentionally excluded (separate deployed-only file,
follow-up per #701).
Added packages/mosaic/framework/tools/git/test-help-exit-code.sh, a
small regression harness matching the existing test-*.sh convention
in this directory: asserts --help and -h exit 0 with usage output for
all 7 wrappers, and that a genuine unknown flag still exits nonzero.
Passes 7/7.
Closes #701