aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gogs.go2
-rw-r--r--pkg/markup/markup.go5
-rw-r--r--routes/repo/commit.go18
-rw-r--r--templates/.VERSION2
4 files changed, 11 insertions, 16 deletions
diff --git a/gogs.go b/gogs.go
index fddb1f60..c40db158 100644
--- a/gogs.go
+++ b/gogs.go
@@ -16,7 +16,7 @@ import (
"github.com/gogs/gogs/pkg/setting"
)
-const APP_VER = "0.11.61.0816"
+const APP_VER = "0.11.62.0817"
func init() {
setting.AppVer = APP_VER
diff --git a/pkg/markup/markup.go b/pkg/markup/markup.go
index b8e1519d..2d571489 100644
--- a/pkg/markup/markup.go
+++ b/pkg/markup/markup.go
@@ -53,9 +53,8 @@ var (
CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`)
// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae
- // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern
- // by converting string to a number.
- Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{40}\b`)
+ // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern by converting string to a number.
+ Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{7,40}\b`)
)
// FindAllMentions matches mention patterns in given content
diff --git a/routes/repo/commit.go b/routes/repo/commit.go
index 42de9a36..8af8d8e0 100644
--- a/routes/repo/commit.go
+++ b/routes/repo/commit.go
@@ -121,8 +121,8 @@ func FileHistory(c *context.Context) {
}
func Diff(c *context.Context) {
- c.Data["PageIsDiff"] = true
- c.Data["RequireHighlightJS"] = true
+ c.PageIs("Diff")
+ c.RequireHighlightJS()
userName := c.Repo.Owner.Name
repoName := c.Repo.Repository.Name
@@ -130,11 +130,7 @@ func Diff(c *context.Context) {
commit, err := c.Repo.GitRepo.GetCommit(commitID)
if err != nil {
- if git.IsErrNotExist(err) {
- c.Handle(404, "Repo.GitRepo.GetCommit", err)
- } else {
- c.Handle(500, "Repo.GitRepo.GetCommit", err)
- }
+ c.NotFoundOrServerError("get commit by ID", git.IsErrNotExist, err)
return
}
@@ -142,7 +138,7 @@ func Diff(c *context.Context) {
commitID, setting.Git.MaxGitDiffLines,
setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles)
if err != nil {
- c.NotFoundOrServerError("GetDiffCommit", git.IsErrNotExist, err)
+ c.NotFoundOrServerError("get diff commit", git.IsErrNotExist, err)
return
}
@@ -151,7 +147,7 @@ func Diff(c *context.Context) {
sha, err := commit.ParentID(i)
parents[i] = sha.String()
if err != nil {
- c.Handle(404, "repo.Diff", err)
+ c.NotFound()
return
}
}
@@ -161,12 +157,12 @@ func Diff(c *context.Context) {
return
}
+ c.Title(commit.Summary() + " · " + tool.ShortSHA1(commitID))
c.Data["CommitID"] = commitID
c.Data["IsSplitStyle"] = c.Query("style") == "split"
c.Data["Username"] = userName
c.Data["Reponame"] = repoName
c.Data["IsImageFile"] = commit.IsImageFile
- c.Data["Title"] = commit.Summary() + " · " + tool.ShortSHA1(commitID)
c.Data["Commit"] = commit
c.Data["Author"] = models.ValidateCommitWithEmail(commit)
c.Data["Diff"] = diff
@@ -177,7 +173,7 @@ func Diff(c *context.Context) {
c.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", parents[0])
}
c.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", commitID)
- c.HTML(200, DIFF)
+ c.Success(DIFF)
}
func RawDiff(c *context.Context) {
diff --git a/templates/.VERSION b/templates/.VERSION
index d04c7a44..9401d1b3 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.11.61.0816
+0.11.62.0817