Skip to content

Commit b34af23

Browse files
fixes
1 parent 4bd9eea commit b34af23

File tree

10 files changed

+26
-128
lines changed

10 files changed

+26
-128
lines changed

custom/conf/app.example.ini

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,18 +2145,6 @@ ROUTER = console
21452145
;NOTICE_ON_SUCCESS = false
21462146
;SCHEDULE = @every 72h
21472147

2148-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2149-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2150-
;; Resynchronize Git configurations of all repositories.
2151-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2152-
;[cron.resync_all_configs]
2153-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2154-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2155-
;ENABLED = false
2156-
;RUN_AT_START = false
2157-
;NOTICE_ON_SUCCESS = false
2158-
;SCHEDULE = @every 72h
2159-
21602148
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21612149
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21622150
;; Reinitialize all missing Git repositories for which records exist

docker/rootless/usr/local/bin/docker-setup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if [ ! -w ${HOME} ]; then echo "${HOME} is not writable"; exit 1; fi
88
mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM}
99

1010
# Prepare temp folder
11+
mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM}
1112
mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP}
1213
if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi
1314

@@ -17,6 +18,8 @@ if [ ! -f ${GITEA_APP_INI} ]; then
1718
#Prepare config file folder
1819
GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI})
1920
mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR}
21+
22+
2023
if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi
2124

2225
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,13 +1011,6 @@ Default templates for project boards:
10111011
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10121012
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10131013

1014-
#### Cron - Resynchronize Git configs of all repositories ('cron.resync_all_configs')
1015-
1016-
- `ENABLED`: **false**: Enable service.
1017-
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
1018-
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
1019-
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
1020-
10211014
#### Cron - Reinitialize all missing Git repositories for which records exist ('cron.reinit_missing_repos')
10221015

10231016
- `ENABLED`: **false**: Enable service.

modules/git/git.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,29 @@ func syncGitConfig() (err error) {
224224
return err
225225
}
226226

227+
if setting.Git.Reflog.Enabled {
228+
if err := configSet("core.logAllRefUpdates", "true"); err != nil {
229+
return err
230+
}
231+
if setting.Git.Reflog.Expiration != 90 {
232+
if err := configSet("gc.reflogExpire", fmt.Sprintf("%d", setting.Git.Reflog.Expiration)); err != nil {
233+
return err
234+
}
235+
} else {
236+
if err := configUnsetAll("gc.reflogExpire", ""); err != nil {
237+
return err
238+
}
239+
}
240+
} else {
241+
if err := configUnsetAll("core.logAllRefUpdates", "true"); err != nil {
242+
return err
243+
} else {
244+
if err := configUnsetAll("gc.reflogExpire", ""); err != nil {
245+
return err
246+
}
247+
}
248+
}
249+
227250
if CheckGitVersionAtLeast("2.10") == nil {
228251
if err := configSet("receive.advertisePushOptions", "true"); err != nil {
229252
return err

modules/git/repo.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"time"
1919

2020
"code.gitea.io/gitea/modules/proxy"
21-
"code.gitea.io/gitea/modules/setting"
2221
"code.gitea.io/gitea/modules/util"
2322
)
2423

@@ -303,47 +302,6 @@ func GetDivergingCommits(ctx context.Context, repoPath, baseBranch, targetBranch
303302
return DivergeObject{ahead, behind}, nil
304303
}
305304

306-
// CreateConfig creates a git config for the repo
307-
func CreateConfig(repoPath string) error {
308-
return createConfig(repoPath)
309-
}
310-
311-
// createConfig creates a git config for the repo
312-
func createConfig(repoPath string) (err error) {
313-
gitConfigPath := filepath.Join(repoPath, "config")
314-
315-
reflogEnabled := setting.Git.Reflog.Enabled
316-
reflogExpirationDays := setting.Git.Reflog.Expiration
317-
318-
configStr := strings.TrimSpace(`
319-
[core]
320-
repositoryformatversion = 0
321-
filemode = true
322-
bare = true
323-
ignorecase = true
324-
precomposeunicode = true
325-
`)
326-
327-
if reflogEnabled {
328-
configStr += "\n logAllRefUpdates = true"
329-
if reflogExpirationDays != 90 {
330-
configStr += "\n[gc]"
331-
configStr += fmt.Sprintf("\n reflogExpire = %d", reflogExpirationDays)
332-
}
333-
}
334-
335-
configStr += "\n"
336-
337-
if err = util.Remove(gitConfigPath); err != nil && !os.IsNotExist(err) {
338-
return fmt.Errorf("unable to pre-remove config file '%s' prior to rewriting: %w ", gitConfigPath, err)
339-
}
340-
if err = os.WriteFile(gitConfigPath, []byte(configStr), 0o644); err != nil {
341-
return fmt.Errorf("write config file '%s': %w", gitConfigPath, err)
342-
}
343-
344-
return nil
345-
}
346-
347305
// CreateBundle create bundle content to the target path
348306
func (repo *Repository) CreateBundle(ctx context.Context, commit string, out io.Writer) error {
349307
tmp, err := os.MkdirTemp(os.TempDir(), "gitea-bundle")

modules/repository/init.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ func checkInitRepository(ctx context.Context, owner, name string) (err error) {
277277
// Init git bare new repository.
278278
if err = git.InitRepository(ctx, repoPath, true); err != nil {
279279
return fmt.Errorf("git.InitRepository: %w", err)
280-
} else if err = git.CreateConfig(repoPath); err != nil {
281-
return fmt.Errorf("git.CreateConfig: %v", err)
282280
} else if err = createDelegateHooks(repoPath); err != nil {
283281
return fmt.Errorf("createDelegateHooks: %w", err)
284282
}

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,6 @@ dashboard.resync_all_sshkeys.desc = (Not needed for the built-in SSH server.)
25432543
dashboard.resync_all_sshprincipals = Update the '.ssh/authorized_principals' file with Gitea SSH principals.
25442544
dashboard.resync_all_sshprincipals.desc = (Not needed for the built-in SSH server.)
25452545
dashboard.resync_all_hooks = Resynchronize pre-receive, update and post-receive hooks of all repositories.
2546-
dashboard.resync_all_configs = Resynchronize Git configuration of all repositories.
25472546
dashboard.reinit_missing_repos = Reinitialize all missing Git repositories for which records exist
25482547
dashboard.sync_external_users = Synchronize external user data
25492548
dashboard.cleanup_hook_task_table = Cleanup hook_task table

services/cron/tasks_extended.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ func registerRepositoryUpdateHook() {
9595
})
9696
}
9797

98-
func registerRepositoryUpdateConfig() {
99-
RegisterTaskFatal("resync_all_configs", &BaseConfig{
100-
Enabled: false,
101-
RunAtStart: false,
102-
Schedule: "@every 72h",
103-
}, func(ctx context.Context, _ *user_model.User, _ Config) error {
104-
return repo_service.SyncRepositoryConfig(ctx)
105-
})
106-
}
107-
10898
func registerReinitMissingRepositories() {
10999
RegisterTaskFatal("reinit_missing_repos", &BaseConfig{
110100
Enabled: false,
@@ -230,7 +220,6 @@ func initExtendedTasks() {
230220
registerRewriteAllPublicKeys()
231221
registerRewriteAllPrincipalKeys()
232222
registerRepositoryUpdateHook()
233-
registerRepositoryUpdateConfig()
234223
registerReinitMissingRepositories()
235224
registerDeleteMissingRepositories()
236225
registerRemoveRandomAvatars()

services/repository/config.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

templates/admin/dashboard.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
<td>{{.locale.Tr "admin.dashboard.resync_all_hooks"}}</td>
5757
<td><button type="submit" class="ui green button" name="op" value="resync_all_hooks">{{svg "octicon-play"}} {{.locale.Tr "admin.dashboard.operation_run"}}</button></td>
5858
</tr>
59-
<tr>
60-
<td>{{.locale.Tr "admin.dashboard.resync_all_configs"}}</td>
61-
<td><button type="submit" class="ui green button" name="op" value="resync_all_configs">{{svg "octicon-play"}} {{.locale.Tr "admin.dashboard.operation_run"}}</button></td>
62-
</tr>
6359
<tr>
6460
<td>{{.locale.Tr "admin.dashboard.reinit_missing_repos"}}</td>
6561
<td><button type="submit" class="ui green button" name="op" value="reinit_missing_repos">{{svg "octicon-play"}} {{.locale.Tr "admin.dashboard.operation_run"}}</button></td>

0 commit comments

Comments
 (0)