aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-04-12 13:51:09 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-04-12 13:51:09 +0800
commitfe4750ebe21a848cd8a3b7bf2789ca40aa56414e (patch)
tree43181de585231e445171c283bceedb0949098daa
parent5f3a6a9d7424a4ba1c0e63f6c3ddfbde6f3598d8 (diff)
parent794b457252b270ae452b3ea946d91b216f27ac5d (diff)
Merge remote-tracking branch 'origin/dev' into dev
-rw-r--r--models/git.go6
-rw-r--r--routers/repo/commit.go1
-rw-r--r--templates/repo/diff.tmpl4
3 files changed, 11 insertions, 0 deletions
diff --git a/models/git.go b/models/git.go
index f20e663b..07f23297 100644
--- a/models/git.go
+++ b/models/git.go
@@ -300,6 +300,12 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
}
i = i + 1
+
+ // Diff data too large.
+ if i == 2000 {
+ return &Diff{}, nil
+ }
+
if line == "" {
continue
}
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index fed1a6ba..dbfd9af2 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -103,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = commit.Message() + " ยท " + base.ShortSha(commitId)
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff
+ ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)
diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl
index a041284d..796a8e94 100644
--- a/templates/repo/diff.tmpl
+++ b/templates/repo/diff.tmpl
@@ -20,6 +20,9 @@
</div>
</div>
+ {{if .DiffNotAvailable}}
+ <h4>Diff Data Not Available.</h4>
+ {{else}}
<div class="diff-detail-box diff-box">
<a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Stats</a>
<p class="showing">
@@ -97,6 +100,7 @@
</div>
</div>
{{end}}
+ {{end}}
</div>
</div>
{{template "base/footer" .}}