From 50264200f04d227ce5e36792cb7b951789693570 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Mon, 14 Dec 2015 09:38:21 -0500 Subject: fix huge diff hangs --- models/git_diff.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'models') diff --git a/models/git_diff.go b/models/git_diff.go index 72580669..21132504 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -9,6 +9,7 @@ import ( "bytes" "fmt" "io" + "io/ioutil" "os" "os/exec" "strings" @@ -124,6 +125,7 @@ func ParsePatch(maxlines int, reader io.Reader) (*Diff, error) { // Diff data too large, we only show the first about maxlines lines if lineCount >= maxlines { log.Warn("Diff data too large") + io.Copy(ioutil.Discard, reader) diff.Files = nil return diff, nil } -- cgit v1.2.3