diff options
author | Unknwon <u@gogs.io> | 2015-11-08 14:31:49 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-11-08 14:31:49 -0500 |
commit | b55499d039c5e35130057b8af16401c558e79e79 (patch) | |
tree | 4f3fc503ac7f1bb4f63733f359ba450fd90f3f1b /cmd/serve.go | |
parent | 58436b5ea51cb5e09fb244331d7a9acf70258063 (diff) | |
download | gitea-b55499d039c5e35130057b8af16401c558e79e79.tar.gz gitea-b55499d039c5e35130057b8af16401c558e79e79.zip |
go vet and fix #1890
Diffstat (limited to 'cmd/serve.go')
-rw-r--r-- | cmd/serve.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cmd/serve.go b/cmd/serve.go index c3c66318da..301a0c74ee 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -74,7 +74,14 @@ var ( func fail(userMessage, logMessage string, args ...interface{}) { fmt.Fprintln(os.Stderr, "Gogs:", userMessage) - log.GitLogger.Fatal(3, logMessage, args...) + + if len(logMessage) > 0 { + log.GitLogger.Fatal(3, logMessage, args...) + return + } + + log.GitLogger.Close() + os.Exit(1) } func handleUpdateTask(uuid string, user *models.User, repoUserName, repoName string) { @@ -161,6 +168,11 @@ func runServ(c *cli.Context) { fail("Unknown git command", "Unknown git command %s", verb) } + // Prohibit push to mirror repositories. + if requestedMode > models.ACCESS_MODE_READ && repo.IsMirror { + fail("mirror repository is read-only", "") + } + // Allow anonymous clone for public repositories. var ( keyID int64 |