Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ insert_final_newline = false
[templates/user/auth/oidc_wellknown.tmpl]
indent_style = space

[templates/shared/actions/runner_badge_*.tmpl]
# editconfig lint requires these XML-like files to have charset defined, but the files don't have.
charset = unset

[Makefile]
indent_style = tab

Expand Down
3 changes: 2 additions & 1 deletion services/pull/merge_squash.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func doMergeStyleSquash(ctx *mergeContext, message string) error {
}
cmdCommit := gitcmd.NewCommand("commit").
AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email).
AddOptionFormat("--message=%s", message)
AddOptionFormat("--message=%s", message).
AddArguments("--allow-empty")
if ctx.signKey == nil {
cmdCommit.AddArguments("--no-gpg-sign")
} else {
Expand Down
32 changes: 32 additions & 0 deletions tests/integration/pull_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,3 +1110,35 @@
session.MakeRequest(t, mergeReq, http.StatusMethodNotAllowed)
})
}

func TestPullSquashMergeEmpty(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
session := loginUser(t, "user1")
testEditFileToNewBranch(t, session, "user2", "repo1", "master", "pr-squash-empty", "README.md", "Hello, World (Edited)\n")
resp := testPullCreate(t, session, "user2", "repo1", false, "master", "pr-squash-empty", "This is a pull title")

elem := strings.Split(test.RedirectURL(resp), "/")
assert.Equal(t, "pulls", elem[3])

httpContext := NewAPITestContext(t, "user2", "repo1", auth_model.AccessTokenScopeWriteRepository)
dstPath := t.TempDir()

u.Path = httpContext.GitPath()
u.User = url.UserPassword("user2", userPassword)

t.Run("Clone", doGitClone(dstPath, u))
doGitCheckoutBranch(dstPath, "-b", "pr-squash-empty", "remotes/origin/pr-squash-empty")(t)
doGitCheckoutBranch(dstPath, "master")(t)
_, _, err := gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").
WithDir(dstPath).

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-backend

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-pgsql

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-sqlite

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mysql

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)

Check failure on line 1133 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mssql

gitcmd.NewCommand("cherry-pick").AddArguments("pr-squash-empty").WithDir undefined (type *gitcmd.Command has no field or method WithDir)
RunStdString(t.Context())
assert.NoError(t, err)

doGitPushTestRepository(dstPath)(t)

testPullMerge(t, session, elem[1], elem[2], elem[4], MergeOptions{

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-backend

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-backend

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-pgsql

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-sqlite

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-sqlite

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mysql

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mysql

undefined: MergeOptions

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mssql

not enough arguments in call to testPullMerge

Check failure on line 1139 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / test-mssql

undefined: MergeOptions
Style: repo_model.MergeStyleSquash,
DeleteBranch: false,
})

Check failure on line 1142 in tests/integration/pull_merge_test.go

View workflow job for this annotation

GitHub Actions / checks-backend

not enough arguments in call to testPullMerge
})
}
Loading