feat: add squash option to merge requests, see #54#56
Conversation
…ations Co-authored-by: Copilot <copilot@github.com>
Coverage |
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring GitLab project “squash on merge” behavior via mergeRequest.squashOption, wiring it from config parsing through project creation and exposing it in docs and output.
Changes:
- Add
SquashOptionto config (MergeRequest) and parse it from Viper with a default. - Map
config.SquashOptionto GitLab APISquashOptionValueduring project creation. - Document the new config key and add unit/integration test coverage for parsing, output, and GitLab behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
gitlab/projects.go |
Maps config.MergeRequest.SquashOption to GitLab CreateProjectOptions.SquashOption. |
gitlab/integration_gitlab_test.go |
Adds integration subtest verifying created projects reflect the configured squash option. |
docs/configuration.md |
Documents mergeRequest.squashOption values, defaults, and examples. |
config/urls_show_test.go |
Adds test ensuring Show() output includes squash option. |
config/types.go |
Introduces SquashOption type/consts and adds field to MergeRequest. |
config/show.go |
Extends Show() output to display SquashOption. |
config/assignment_test.go |
Adds tests for default squash option and parsing all supported values. |
config/assignment.go |
Parses mergeRequest.squashOption from config and stores it in MergeRequest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| squashOption := SquashDefaultOff | ||
| if cfg.MergeRequest != nil { | ||
| mergeMethod = cfg.MergeRequest.MergeMethod | ||
| squashOption = cfg.MergeRequest.SquashOption |
There was a problem hiding this comment.
When cfg.MergeRequest is non-nil but SquashOption is left unset (zero value ""), this assignment overwrites the default SquashDefaultOff and Show() will print an empty squash option. Consider only overriding the default when cfg.MergeRequest.SquashOption is non-empty (or ensure MergeRequest is always fully defaulted when constructed manually).
| squashOption = cfg.MergeRequest.SquashOption | |
| if cfg.MergeRequest.SquashOption != "" { | |
| squashOption = cfg.MergeRequest.SquashOption | |
| } |
No description provided.