aboutsummaryrefslogtreecommitdiff
path: root/models/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/git.go')
-rw-r--r--models/git.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/git.go b/models/git.go
index f20e663b..e32b5ba9 100644
--- a/models/git.go
+++ b/models/git.go
@@ -21,6 +21,7 @@ import (
"github.com/gogits/git"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/log"
)
// RepoFile represents a file object in git repository.
@@ -300,6 +301,13 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
}
i = i + 1
+
+ // Diff data too large.
+ if i == 5000 {
+ log.Warn("Diff data too large")
+ return &Diff{}, nil
+ }
+
if line == "" {
continue
}