Skip to content

Commit fe4750e

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents 5f3a6a9 + 794b457 commit fe4750e

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

models/git.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,12 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
300300
}
301301

302302
i = i + 1
303+
304+
// Diff data too large.
305+
if i == 2000 {
306+
return &Diff{}, nil
307+
}
308+
303309
if line == "" {
304310
continue
305311
}

routers/repo/commit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) {
103103
ctx.Data["Title"] = commit.Message() + " · " + base.ShortSha(commitId)
104104
ctx.Data["Commit"] = commit
105105
ctx.Data["Diff"] = diff
106+
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
106107
ctx.Data["IsRepoToolbarCommits"] = true
107108
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
108109
ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)

templates/repo/diff.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
</div>
2121
</div>
2222

23+
{{if .DiffNotAvailable}}
24+
<h4>Diff Data Not Available.</h4>
25+
{{else}}
2326
<div class="diff-detail-box diff-box">
2427
<a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Stats</a>
2528
<p class="showing">
@@ -97,6 +100,7 @@
97100
</div>
98101
</div>
99102
{{end}}
103+
{{end}}
100104
</div>
101105
</div>
102106
{{template "base/footer" .}}

0 commit comments

Comments
 (0)