Skip to content

Commit

Permalink
Default squash-merge behaviour must be OFF
Browse files Browse the repository at this point in the history
My original PR introduced an entirely wrong behaviour which is _also_ a
breaking change.  Fix this bad default.
  • Loading branch information
arielshaqed committed Jan 9, 2025
1 parent 768d728 commit 9ef4efe
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ components:
description: Allow merge when the branches have the same content
squash_merge:
type: boolean
default: true
default: false
description: |
If set, set only the destination branch as a parent, which "squashes" the merge to
appear as a single commit on the destination branch. The source commit is no longer
Expand Down
4 changes: 2 additions & 2 deletions clients/java/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/python/docs/Merge.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions clients/python/lakefs_sdk/models/merge.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/rust/docs/Merge.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/js/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ components:
description: Allow merge when the branches have the same content
squash_merge:
type: boolean
default: true
default: false
description: |
If set, set only the destination branch as a parent, which "squashes" the merge to
appear as a single commit on the destination branch. The source commit is no longer
Expand Down
14 changes: 10 additions & 4 deletions pkg/api/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3826,27 +3826,33 @@ func TestController_MergeSquashing(t *testing.T) {

cases := []struct {
Name string
Squash bool
Squash *bool
ExpectedNumCommits int
}{{
Name: "regular",
Squash: false,
Squash: swag.BooleanValue(false),

Check failure on line 3833 in pkg/api/controller_test.go

View workflow job for this annotation

GitHub Actions / Run Go tests

undefined: swag.BooleanValue
// Commits: 1 "created repository", numCommits on branch, 1 merge.
ExpectedNumCommits: numCommits + 2,
}, {
Name: "squash",
Squash: true,
Squash: swag.BooleanValue(true),

Check failure on line 3838 in pkg/api/controller_test.go

View workflow job for this annotation

GitHub Actions / Run Go tests

undefined: swag.BooleanValue
// Commits: 1 "created repository", 1 merge.
ExpectedNumCommits: 2,
}, {
Name: "default",
Squash: nil,
// Commits: 1 "created repository", 1 merge.
ExpectedNumCommits: numCommits + 2,
}}

for _, tc := range cases {
t.Run(tc.Name, func(t *testing.T) {
destinationBranch := "main-" + tc.Name

_, err := deps.catalog.CreateBranch(ctx, repo, destinationBranch, "main")
testutil.Must(t, err)

mergeResp, err := clt.MergeIntoBranchWithResponse(ctx, repo, "branch", destinationBranch, apigen.MergeIntoBranchJSONRequestBody{SquashMerge: &tc.Squash})
mergeResp, err := clt.MergeIntoBranchWithResponse(ctx, repo, "branch", destinationBranch, apigen.MergeIntoBranchJSONRequestBody{SquashMerge: tc.Squash})
testutil.MustDo(t, "perform merge into branch", err)
if !apiutil.IsStatusCodeOK(mergeResp.StatusCode()) {
t.Fatal("merge request failed", mergeResp.Status())
Expand Down

0 comments on commit 9ef4efe

Please sign in to comment.