mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-19 16:18:11 +00:00
Adds a repository setting for the default squash merge commit message body with GitHub's options `PR_BODY`, `COMMIT_MESSAGES` and `BLANK`, also settable via `squash_merge_commit_message` in the API. The commit title stays the pull request title. 1. Breaking: API squash merges without `merge_message_field` now get the same default message as the web merge box instead of a title-only commit, which affects clients sending only `Do` like Renovate. An empty value keeps title-only. 2. Breaking: `[repository.pull-request] DEFAULT_SQUASH_MERGE_MESSAGE` replaces `POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES`, which still works as a deprecated fallback. Repositories store the default when created or next saved. 3. Deprecated app.ini keys now migrate through one table instead of per-loader fallbacks, which also fixes the ignored `[mailer] CERT_FILE` and `KEY_FILE` fallbacks. Deprecation warnings no longer claim a removal version. <img width="1891" height="571" alt="grafik" src="https://github.com/user-attachments/assets/0fdcde13-1f11-4156-b598-d80eb0d04cbe" /> --------- Co-authored-by: silverwind <me@silverwind.io>
65 lines
1.4 KiB
Go
65 lines
1.4 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package setting
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitea.dev/modules/test"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGitConfig(t *testing.T) {
|
|
oldGit := Git
|
|
oldGitConfig := GitConfig
|
|
defer func() {
|
|
Git = oldGit
|
|
GitConfig = oldGitConfig
|
|
}()
|
|
|
|
cfg, err := NewConfigProviderFromData(`
|
|
[git.config]
|
|
a.b = 1
|
|
`)
|
|
assert.NoError(t, err)
|
|
loadGitFrom(cfg)
|
|
assert.Equal(t, "1", GitConfig.Options["a.b"])
|
|
assert.Equal(t, "histogram", GitConfig.Options["diff.algorithm"])
|
|
|
|
cfg, err = NewConfigProviderFromData(`
|
|
[git.config]
|
|
diff.algorithm = other
|
|
`)
|
|
assert.NoError(t, err)
|
|
loadGitFrom(cfg)
|
|
assert.Equal(t, "other", GitConfig.Options["diff.algorithm"])
|
|
}
|
|
|
|
func TestGitReflog(t *testing.T) {
|
|
defer test.MockVariableValue(&Git)()
|
|
defer test.MockVariableValue(&GitConfig)()
|
|
|
|
// default reflog config without legacy options
|
|
cfg, err := NewConfigProviderFromData(``)
|
|
assert.NoError(t, err)
|
|
loadGitFrom(cfg)
|
|
|
|
assert.Equal(t, "true", GitConfig.GetOption("core.logAllRefUpdates"))
|
|
assert.Empty(t, GitConfig.GetOption("gc.reflogExpire"))
|
|
|
|
// custom reflog config by legacy options
|
|
cfg, err = NewConfigProviderFromData(`
|
|
[git.reflog]
|
|
ENABLED = false
|
|
EXPIRATION = 123
|
|
`)
|
|
assert.NoError(t, err)
|
|
applyDeprecatedKeys(cfg)
|
|
loadGitFrom(cfg)
|
|
|
|
assert.Equal(t, "false", GitConfig.GetOption("core.logAllRefUpdates"))
|
|
assert.Equal(t, "123.days", GitConfig.GetOption("gc.reflogExpire"))
|
|
}
|