summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-08 14:31:49 -0500
committerUnknwon <u@gogs.io>2015-11-08 14:31:49 -0500
commitb55499d039c5e35130057b8af16401c558e79e79 (patch)
tree4f3fc503ac7f1bb4f63733f359ba450fd90f3f1b
parent58436b5ea51cb5e09fb244331d7a9acf70258063 (diff)
downloadgitea-b55499d039c5e35130057b8af16401c558e79e79.tar.gz
gitea-b55499d039c5e35130057b8af16401c558e79e79.zip
go vet and fix #1890
-rw-r--r--.bra.toml4
-rw-r--r--Makefile9
-rw-r--r--cmd/serve.go14
-rw-r--r--gogs.go2
-rw-r--r--models/action.go4
-rw-r--r--models/migrations/migrations.go4
-rw-r--r--modules/cron/parser_test.go2
-rw-r--r--routers/repo/commit.go2
-rw-r--r--routers/repo/http.go2
-rw-r--r--routers/repo/repo.go5
-rw-r--r--templates/.VERSION2
11 files changed, 30 insertions, 20 deletions
diff --git a/.bra.toml b/.bra.toml
index bd245653f1..8789ca8fd5 100644
--- a/.bra.toml
+++ b/.bra.toml
@@ -13,7 +13,7 @@ watch_dirs = [
watch_exts = [".go"]
build_delay = 1500
cmds = [
- ["go", "install", "-tags", "sqlite"],# redis memcache cert pam tidb
- ["go", "build", "-tags", "sqlite"],
+ ["go", "install"], # sqlite redis memcache cert pam tidb
+ ["go", "build"],
["./gogs", "web"]
] \ No newline at end of file
diff --git a/Makefile b/Makefile
index 971727d704..ee4950781a 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,10 @@ build:
go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
+govet:
+ go tool vet -composites=false -methods=false -structtags=false .
+
pack:
- find . -name ".DS_Store" -print0 | xargs -0 rm
rm -rf $(RELEASE_GOGS)
mkdir -p $(RELEASE_GOGS)
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
@@ -27,4 +29,7 @@ bindata:
go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
clean:
- go clean -i ./... \ No newline at end of file
+ go clean -i ./...
+
+clean-mac: clean
+ find . -name ".DS_Store" -print0 | xargs -0 rm \ No newline at end of file
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
diff --git a/gogs.go b/gogs.go
index c4466d0a89..fc63c7d3ff 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.7.0.1107 Beta"
+const APP_VER = "0.7.0.1108 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/action.go b/models/action.go
index cfa6e14d93..e94bb9441b 100644
--- a/models/action.go
+++ b/models/action.go
@@ -147,7 +147,7 @@ func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
RepoName: repo.Name,
IsPrivate: repo.IsPrivate,
}); err != nil {
- return fmt.Errorf("notify watchers '%d/%s': %v", u.Id, repo.ID, err)
+ return fmt.Errorf("notify watchers '%d/%d': %v", u.Id, repo.ID, err)
}
log.Trace("action.newRepoAction: %s/%s", u.Name, repo.Name)
@@ -488,7 +488,7 @@ func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repos
IsPrivate: repo.IsPrivate,
Content: path.Join(oldOwner.LowerName, repo.LowerName),
}); err != nil {
- return fmt.Errorf("notify watchers '%d/%s': %v", actUser.Id, repo.ID, err)
+ return fmt.Errorf("notify watchers '%d/%d': %v", actUser.Id, repo.ID, err)
}
// Remove watch for organization.
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index d7549d07fa..0d17cf2691 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -456,7 +456,7 @@ func trimCommitActionAppUrlPrefix(x *xorm.Engine) error {
pushCommits = new(PushCommits)
if err = json.Unmarshal(action["content"], pushCommits); err != nil {
- return fmt.Errorf("unmarshal action content[%s]: %v", actID, err)
+ return fmt.Errorf("unmarshal action content[%d]: %v", actID, err)
}
infos := strings.Split(pushCommits.CompareUrl, "/")
@@ -467,7 +467,7 @@ func trimCommitActionAppUrlPrefix(x *xorm.Engine) error {
p, err := json.Marshal(pushCommits)
if err != nil {
- return fmt.Errorf("marshal action content[%s]: %v", actID, err)
+ return fmt.Errorf("marshal action content[%d]: %v", actID, err)
}
if _, err = sess.Id(actID).Update(&Action{
diff --git a/modules/cron/parser_test.go b/modules/cron/parser_test.go
index 9050cf7869..f03299e5e4 100644
--- a/modules/cron/parser_test.go
+++ b/modules/cron/parser_test.go
@@ -111,7 +111,7 @@ func TestSpecSchedule(t *testing.T) {
t.Error(err)
}
if !reflect.DeepEqual(actual, c.expected) {
- t.Errorf("%s => (expected) %b != %b (actual)", c.expr, c.expected, actual)
+ t.Errorf("%s => (expected) %v != %v (actual)", c.expr, c.expected, actual)
}
}
}
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 13483cc881..d0dd01de88 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -38,7 +38,6 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
newCommits := list.New()
for e := oldCommits.Front(); e != nil; e = e.Next() {
c := e.Value.(*git.Commit)
- c.CommitMessage = c.CommitMessage
newCommits.PushBack(c)
}
return newCommits
@@ -196,7 +195,6 @@ func Diff(ctx *middleware.Context) {
commitID := ctx.Repo.CommitID
commit := ctx.Repo.Commit
- commit.CommitMessage = commit.CommitMessage
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
commitID, setting.Git.MaxGitDiffLines)
if err != nil {
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 178ae92c1a..214cc9ba39 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -158,7 +158,7 @@ func HTTP(ctx *middleware.Context) {
}
if !isPull && repo.IsMirror {
- ctx.HandleText(401, "can't push to mirror")
+ ctx.HandleText(401, "mirror repository is read-only")
return
}
}
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index a13526edf4..ab7b4b99e5 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -250,11 +250,6 @@ func Action(ctx *middleware.Context) {
redirectTo = ctx.Repo.RepoLink
}
ctx.Redirect(redirectTo)
-
- return
- ctx.JSON(200, map[string]interface{}{
- "ok": true,
- })
}
func Download(ctx *middleware.Context) {
diff --git a/templates/.VERSION b/templates/.VERSION
index 23a2f1822b..b2e3cc9c25 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.7.0.1107 Beta \ No newline at end of file
+0.7.0.1108 Beta \ No newline at end of file