From ebb05475ed15fffc37145799ce7c72b65ccdbfc5 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 23 Sep 2014 13:06:25 -0400 Subject: [PATCH] Fix #495 and cannot view repository by tag --- cmd/web.go | 2 +- gogs.go | 2 +- modules/git/repo_tag.go | 1 + modules/middleware/repo.go | 8 ++++++-- public/ng/css/ui.css | 3 ++- public/ng/less/ui/reset.less | 6 ++---- templates/.VERSION | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/web.go b/cmd/web.go index a5ebf259e..e2c929c1c 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -355,7 +355,7 @@ func runWeb(*cli.Context) { r.Get("/commit/:branchname", repo.Diff) r.Get("/commit/:branchname/*", repo.Diff) r.Get("/releases", repo.Releases) - r.Get("/archive/*.*", repo.Download) + r.Get("/archive/:branchname/*.*", repo.Download) r.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff) }, ignSignIn, middleware.RepoAssignment(true, true)) diff --git a/gogs.go b/gogs.go index 847330424..0821dbc22 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.4.0922 Beta" +const APP_VER = "0.5.4.0923 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/git/repo_tag.go b/modules/git/repo_tag.go index 21818f3e6..dd31e4414 100644 --- a/modules/git/repo_tag.go +++ b/modules/git/repo_tag.go @@ -77,6 +77,7 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) { } tag.Id = id + tag.Object = id tag.repo = repo repo.tagCache[id] = tag diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index f17018ddf..7227e05de 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -213,7 +213,11 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { ctx.Handle(404, "RepoAssignment invalid tag", nil) return } - ctx.Repo.Commit, _ = ctx.Repo.Tag.Commit() + ctx.Repo.Commit, err = ctx.Repo.Tag.Commit() + if err != nil { + ctx.Handle(500, "RepoAssignment", fmt.Errorf("fail to get tag commit(%s): %v", refName, err)) + return + } ctx.Repo.CommitId = ctx.Repo.Commit.Id.String() } else if len(refName) == 40 { ctx.Repo.IsCommit = true @@ -226,7 +230,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler { return } } else { - ctx.Handle(404, "RepoAssignment invalid repo", errors.New("branch or tag not exist")) + ctx.Handle(404, "RepoAssignment invalid repo", fmt.Errorf("branch or tag not exist: %s", refName)) return } diff --git a/public/ng/css/ui.css b/public/ng/css/ui.css index f3f6eded7..5dc3cc040 100644 --- a/public/ng/css/ui.css +++ b/public/ng/css/ui.css @@ -151,7 +151,8 @@ code, kbd, pre, samp { - font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-family: monospace, monospace; + font-size: 1em; } .text-left { text-align: left; diff --git a/public/ng/less/ui/reset.less b/public/ng/less/ui/reset.less index 8ff45d694..0e7a50e40 100644 --- a/public/ng/less/ui/reset.less +++ b/public/ng/less/ui/reset.less @@ -193,21 +193,19 @@ code, kbd, pre, samp { - font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-family: monospace, monospace; + font-size: 1em; } .text-left { text-align: left; } - .text-right { text-align: right; } - .text-center { text-align: center; } - .list-no-style { list-style: none; } diff --git a/templates/.VERSION b/templates/.VERSION index 8a713df04..23f5f0fe5 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.4.0922 Beta \ No newline at end of file +0.5.4.0923 Beta \ No newline at end of file