diff options
author | zeripath <art27@cantab.net> | 2021-10-13 20:47:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 20:47:02 +0100 |
commit | 5a8dd96b33ac6e91a5c40fc4ef867625ca6ec88e (patch) | |
tree | 5b57df8b2b234382f438015348f201f96f264c7f /modules/repository/create.go | |
parent | 01b9d35f1a0188dadc1ee09f5e4dd98acc38ff09 (diff) | |
download | gitea-5a8dd96b33ac6e91a5c40fc4ef867625ca6ec88e.tar.gz gitea-5a8dd96b33ac6e91a5c40fc4ef867625ca6ec88e.zip |
Ensure that git daemon export ok is created for mirrors (#17243)
* Ensure that git daemon export ok is created for mirrors
There is an issue with #16508 where it appears that create repo requires that the
repo does not exist. This causes #17241 where an error is reported because of this.
This PR fixes this and also runs update-server-info for mirrors and generated repos.
Fix #17241
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/repository/create.go')
-rw-r--r-- | modules/repository/create.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/repository/create.go b/modules/repository/create.go index 0e91a73b83..64d92eeb2d 100644 --- a/modules/repository/create.go +++ b/modules/repository/create.go @@ -105,7 +105,11 @@ func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (*mod } } - if stdout, err := git.NewCommand("update-server-info"). + if err := repo.CheckDaemonExportOK(ctx); err != nil { + return fmt.Errorf("checkDaemonExportOK: %v", err) + } + + if stdout, err := git.NewCommandContext(ctx, "update-server-info"). SetDescription(fmt.Sprintf("CreateRepository(git update-server-info): %s", repoPath)). RunInDir(repoPath); err != nil { log.Error("CreateRepository(git update-server-info) in %v: Stdout: %s\nError: %v", repo, stdout, err) |