diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 40dd7d56db..ff88a35cd0 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -709,10 +709,6 @@ LEVEL = Info ;; see more on http://git-scm.com/docs/git-gc/ ;GC_ARGS = ;; -;; If use git wire protocol version 2 when git version >= 2.18, default is true, set to false when you always want git wire protocol version 1 -;; To enable this for Git over SSH when using a OpenSSH server, add `AcceptEnv GIT_PROTOCOL` to your sshd_config file. -;ENABLE_AUTO_GIT_WIRE_PROTOCOL = true -;; ;; Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled) ;PULL_REQUEST_PUSH_MESSAGE = true ;; Disable the usage of using partial clones for git. diff --git a/modules/git/git.go b/modules/git/git.go index ea3e2a1320..b58209dd28 100644 --- a/modules/git/git.go +++ b/modules/git/git.go @@ -111,15 +111,7 @@ func VersionInfo() string { if GitVersion == nil { return "(git not found)" } - format := "%s" - args := []any{GitVersion.Original()} - // Since git wire protocol has been released from git v2.18 - if setting.Git.EnableAutoGitWireProtocol { - format += ", Wire Protocol %s Enabled" - args = append(args, "Version 2") // for focus color - } - - return fmt.Sprintf(format, args...) + return GitVersion.Original() } func checkInit() error { @@ -173,10 +165,6 @@ func InitFull(ctx context.Context) (err error) { _ = os.Setenv("GNUPGHOME", filepath.Join(HomeDir(), ".gnupg")) } - if setting.Git.EnableAutoGitWireProtocol { - globalCommandArgs = append(globalCommandArgs, "-c", "protocol.version=2") - } - // Explicitly disable credential helper, otherwise Git credentials might leak globalCommandArgs = append(globalCommandArgs, "-c", "credential.helper=") diff --git a/modules/setting/git.go b/modules/setting/git.go index 04543e803d..3dfec787bf 100644 --- a/modules/setting/git.go +++ b/modules/setting/git.go @@ -17,18 +17,17 @@ var Git = struct { HomePath string DisableDiffHighlight bool - MaxGitDiffLines int - MaxGitDiffLineCharacters int - MaxGitDiffFiles int - CommitsRangeSize int // CommitsRangeSize the default commits range size - BranchesRangeSize int // BranchesRangeSize the default branches range size - VerbosePush bool - VerbosePushDelay time.Duration - GCArgs []string `ini:"GC_ARGS" delim:" "` - EnableAutoGitWireProtocol bool - PullRequestPushMessage bool - DisablePartialClone bool - Timeout struct { + MaxGitDiffLines int + MaxGitDiffLineCharacters int + MaxGitDiffFiles int + CommitsRangeSize int // CommitsRangeSize the default commits range size + BranchesRangeSize int // BranchesRangeSize the default branches range size + VerbosePush bool + VerbosePushDelay time.Duration + GCArgs []string `ini:"GC_ARGS" delim:" "` + PullRequestPushMessage bool + DisablePartialClone bool + Timeout struct { Default int Migrate int Mirror int @@ -38,18 +37,17 @@ var Git = struct { Grep int } `ini:"git.timeout"` }{ - DisableDiffHighlight: false, - MaxGitDiffLines: 1000, - MaxGitDiffLineCharacters: 5000, - MaxGitDiffFiles: 100, - CommitsRangeSize: 50, - BranchesRangeSize: 20, - VerbosePush: true, - VerbosePushDelay: 5 * time.Second, - GCArgs: []string{}, - EnableAutoGitWireProtocol: true, - PullRequestPushMessage: true, - DisablePartialClone: false, + DisableDiffHighlight: false, + MaxGitDiffLines: 1000, + MaxGitDiffLineCharacters: 5000, + MaxGitDiffFiles: 100, + CommitsRangeSize: 50, + BranchesRangeSize: 20, + VerbosePush: true, + VerbosePushDelay: 5 * time.Second, + GCArgs: []string{}, + PullRequestPushMessage: true, + DisablePartialClone: false, Timeout: struct { Default int Migrate int @@ -97,16 +95,6 @@ func loadGitFrom(rootCfg ConfigProvider) { GitConfig.SetOption("core.logAllRefUpdates", "true") GitConfig.SetOption("gc.reflogExpire", "90") - secGitReflog := rootCfg.Section("git.reflog") - if secGitReflog.HasKey("ENABLED") { - deprecatedSetting(rootCfg, "git.reflog", "ENABLED", "git.config", "core.logAllRefUpdates", "1.21") - GitConfig.SetOption("core.logAllRefUpdates", secGitReflog.Key("ENABLED").In("true", []string{"true", "false"})) - } - if secGitReflog.HasKey("EXPIRATION") { - deprecatedSetting(rootCfg, "git.reflog", "EXPIRATION", "git.config", "core.reflogExpire", "1.21") - GitConfig.SetOption("gc.reflogExpire", secGitReflog.Key("EXPIRATION").String()) - } - for _, key := range secGitConfig.Keys() { GitConfig.SetOption(key.Name(), key.String()) } diff --git a/modules/setting/git_test.go b/modules/setting/git_test.go index 5604151907..7cbf1d70a3 100644 --- a/modules/setting/git_test.go +++ b/modules/setting/git_test.go @@ -38,23 +38,11 @@ func TestGitReflog(t *testing.T) { defer test.MockProtect(&Git)() defer test.MockProtect(&GitConfig)() - // default reflog config without legacy options + // default reflog config. cfg, err := NewConfigProviderFromData(``) require.NoError(t, err) loadGitFrom(cfg) assert.Equal(t, "true", GitConfig.GetOption("core.logAllRefUpdates")) assert.Equal(t, "90", GitConfig.GetOption("gc.reflogExpire")) - - // custom reflog config by legacy options - cfg, err = NewConfigProviderFromData(` -[git.reflog] -ENABLED = false -EXPIRATION = 123 -`) - require.NoError(t, err) - loadGitFrom(cfg) - - assert.Equal(t, "false", GitConfig.GetOption("core.logAllRefUpdates")) - assert.Equal(t, "123", GitConfig.GetOption("gc.reflogExpire")) }