Browse Source
Move update-server-info to hooks (#12826)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
mj-v1.14.3
zeripath
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
4 deletions
-
cmd/hook.go
-
services/repository/push.go
|
|
@ -285,6 +285,12 @@ func runHookUpdate(c *cli.Context) error { |
|
|
|
} |
|
|
|
|
|
|
|
func runHookPostReceive(c *cli.Context) error { |
|
|
|
// First of all run update-server-info no matter what
|
|
|
|
if _, err := git.NewCommand("update-server-info").Run(); err != nil { |
|
|
|
return fmt.Errorf("Failed to call 'git update-server-info': %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
// Now if we're an internal don't do anything else
|
|
|
|
if os.Getenv(models.EnvIsInternal) == "true" { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
@ -180,10 +180,6 @@ func pushUpdates(optsList []*PushUpdateOptions) error { |
|
|
|
} |
|
|
|
|
|
|
|
repoPath := repo.RepoPath() |
|
|
|
_, err = git.NewCommand("update-server-info").RunInDir(repoPath) |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("Failed to call 'git update-server-info': %v", err) |
|
|
|
} |
|
|
|
gitRepo, err := git.OpenRepository(repoPath) |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("OpenRepository: %v", err) |
|
|
|