Fix #495 and cannot view repository by tag
This commit is contained in:
parent
a11ed51bbb
commit
ebb05475ed
7 changed files with 14 additions and 10 deletions
|
@ -355,7 +355,7 @@ func runWeb(*cli.Context) {
|
||||||
r.Get("/commit/:branchname", repo.Diff)
|
r.Get("/commit/:branchname", repo.Diff)
|
||||||
r.Get("/commit/:branchname/*", repo.Diff)
|
r.Get("/commit/:branchname/*", repo.Diff)
|
||||||
r.Get("/releases", repo.Releases)
|
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)
|
r.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true, true))
|
}, ignSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.5.4.0922 Beta"
|
const APP_VER = "0.5.4.0923 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -77,6 +77,7 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.Id = id
|
tag.Id = id
|
||||||
|
tag.Object = id
|
||||||
tag.repo = repo
|
tag.repo = repo
|
||||||
|
|
||||||
repo.tagCache[id] = tag
|
repo.tagCache[id] = tag
|
||||||
|
|
|
@ -213,7 +213,11 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
||||||
ctx.Handle(404, "RepoAssignment invalid tag", nil)
|
ctx.Handle(404, "RepoAssignment invalid tag", nil)
|
||||||
return
|
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()
|
ctx.Repo.CommitId = ctx.Repo.Commit.Id.String()
|
||||||
} else if len(refName) == 40 {
|
} else if len(refName) == 40 {
|
||||||
ctx.Repo.IsCommit = true
|
ctx.Repo.IsCommit = true
|
||||||
|
@ -226,7 +230,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,8 @@ code,
|
||||||
kbd,
|
kbd,
|
||||||
pre,
|
pre,
|
||||||
samp {
|
samp {
|
||||||
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
font-family: monospace, monospace;
|
||||||
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
.text-left {
|
.text-left {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
|
@ -193,21 +193,19 @@ code,
|
||||||
kbd,
|
kbd,
|
||||||
pre,
|
pre,
|
||||||
samp {
|
samp {
|
||||||
font: 14px Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
font-family: monospace, monospace;
|
||||||
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-left {
|
.text-left {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-right {
|
.text-right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-no-style {
|
.list-no-style {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.5.4.0922 Beta
|
0.5.4.0923 Beta
|
Reference in a new issue