summaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-05-28 09:07:14 +0800
committerGitHub <noreply@github.com>2023-05-28 01:07:14 +0000
commit2f149c5c9db97f20fbbc65e32d1f3133048b11a2 (patch)
tree5ba9cbca56fadf9c89ffc0a96172ee335b14a4fb /modules/git
parent0d54395fb544d52585046bf0424659cec0626e31 (diff)
downloadgitea-2f149c5c9db97f20fbbc65e32d1f3133048b11a2.tar.gz
gitea-2f149c5c9db97f20fbbc65e32d1f3133048b11a2.zip
Use `[git.config]` for reflog cleaning up (#24958)
Follow https://github.com/go-gitea/gitea/pull/24860#discussion_r1200589651 Use `[git.config]` for reflog cleaning up, the new options are more flexible. * https://git-scm.com/docs/git-config#Documentation/git-config.txt-corelogAllRefUpdates * https://git-scm.com/docs/git-config#Documentation/git-config.txt-gcreflogExpire ## :warning: BREAKING The section `[git.reflog]` is now obsolete and its keys have been moved to the following replacements: - `[git.reflog].ENABLED` → `[git.config].core.logAllRefUpdates` - `[git.reflog].EXPIRATION` → `[git.config].gc.reflogExpire`
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/git.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/modules/git/git.go b/modules/git/git.go
index 2e0a16fb5c..f9c0ed669f 100644
--- a/modules/git/git.go
+++ b/modules/git/git.go
@@ -201,23 +201,6 @@ func InitFull(ctx context.Context) (err error) {
return syncGitConfig()
}
-func enableReflogs() error {
- if err := configSet("core.logAllRefUpdates", "true"); err != nil {
- return err
- }
- err := configSet("gc.reflogExpire", fmt.Sprintf("%d", setting.Git.Reflog.Expiration))
- return err
-}
-
-func disableReflogs() error {
- if err := configUnsetAll("core.logAllRefUpdates", "true"); err != nil {
- return err
- } else if err := configUnsetAll("gc.reflogExpire", ""); err != nil {
- return err
- }
- return nil
-}
-
// syncGitConfig only modifies gitconfig, won't change global variables (otherwise there will be data-race problem)
func syncGitConfig() (err error) {
if err = os.MkdirAll(HomeDir(), os.ModePerm); err != nil {
@@ -249,16 +232,6 @@ func syncGitConfig() (err error) {
return err
}
- if setting.Git.Reflog.Enabled {
- if err := enableReflogs(); err != nil {
- return err
- }
- } else {
- if err := disableReflogs(); err != nil {
- return err
- }
- }
-
if CheckGitVersionAtLeast("2.10") == nil {
if err := configSet("receive.advertisePushOptions", "true"); err != nil {
return err