fix huge diff hangs

This commit is contained in:
Unknwon 2015-12-14 09:38:21 -05:00
parent 7436ce6403
commit 50264200f0
5 changed files with 6 additions and 4 deletions

View file

@ -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
}