fix(mr): allow boolean flags to explicitly override project defaults
Summary
Fixes three boolean flags (--squash-before-merge, --remove-source-branch, --allow-collaboration) to allow users to explicitly override project defaults by setting them to false.
What was broken
Previously, these flags used plain bool types which couldn't distinguish between:
- User didn't set the flag (should use project default)
- User explicitly set
--flag=false(should override project default)
Both cases resulted in the same behavior: the API field was not set, so GitLab used project defaults.
What changed
- Changed three fields from
boolto*bool:SquashBeforeMergeRemoveSourceBranchAllowCollaboration
- Updated flag handling in
complete()to only set the pointer when the flag is explicitly provided - Updated
run()to check fornilinstead of a separate tracking field - Enhanced flag descriptions to clarify override behavior
- Follows the established pattern from the
project updatecommand
Behavior now
For all three flags:
-
Flag omitted: API field is
nil→ GitLab uses project default -
--flagor--flag=true: API field istrue→ Enable the setting -
--flag=false: API field isfalse→ Disable the setting (overrides project default)
Resolves: #8144 (closed)
Test plan
- Added unit tests covering all three states for all affected flags
- All existing tests pass
- Documentation regenerated
Edited by Kai Armstrong