diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-09-23 13:06:25 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-09-23 13:06:25 -0400 |
commit | ebb05475ed15fffc37145799ce7c72b65ccdbfc5 (patch) | |
tree | 013ad9450ad03cb84b8f0f68d433365e57a37468 /modules | |
parent | a11ed51bbbdde56967e1499325ae85d9d86712e7 (diff) | |
download | gitea-ebb05475ed15fffc37145799ce7c72b65ccdbfc5.tar.gz gitea-ebb05475ed15fffc37145799ce7c72b65ccdbfc5.zip |
Fix #495 and cannot view repository by tag
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/repo_tag.go | 1 | ||||
-rw-r--r-- | modules/middleware/repo.go | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/modules/git/repo_tag.go b/modules/git/repo_tag.go index 21818f3e6b..dd31e4414f 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 f17018ddf3..7227e05de7 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 } |