diff --git a/models/git.go b/models/git.go index f20e663b1b..10e8ca48ba 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 == 10000 { + return &Diff{}, nil + } + if line == "" { continue } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index fed1a6badd..dbfd9af297 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 a041284d00..796a8e94c3 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -20,6 +20,9 @@ + {{if .DiffNotAvailable}} +
@@ -97,6 +100,7 @@