From 50264200f04d227ce5e36792cb7b951789693570 Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Mon, 14 Dec 2015 09:38:21 -0500
Subject: [PATCH] fix huge diff hangs

---
 README.md          | 2 +-
 cmd/web.go         | 2 +-
 gogs.go            | 2 +-
 models/git_diff.go | 2 ++
 templates/.VERSION | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 1a26ed0f94..438cba5ab2 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
 
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
 
-##### Current version: 0.8.3
+##### Current version: 0.8.4
 
 | Web | UI  | Preview  |
 |:-------------:|:-------:|:-------:|
diff --git a/cmd/web.go b/cmd/web.go
index aec091e453..87fe1b6a77 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -88,7 +88,7 @@ func checkVersion() {
 		{"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
 		{"gopkg.in/ini.v1", ini.Version, "1.8.4"},
 		{"gopkg.in/macaron.v1", macaron.Version, "0.8.0"},
-		{"github.com/gogits/git-shell", git.Version, "0.2.0"},
+		{"github.com/gogits/git-shell", git.Version, "0.2.1"},
 	}
 	for _, c := range checkers {
 		if !version.Compare(c.Version(), c.Expected, ">=") {
diff --git a/gogs.go b/gogs.go
index 80f2f4b517..8b9286f224 100644
--- a/gogs.go
+++ b/gogs.go
@@ -18,7 +18,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.8.3.1214"
+const APP_VER = "0.8.4.1214"
 
 func init() {
 	runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/git_diff.go b/models/git_diff.go
index 725806699e..2113250451 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
 		}
diff --git a/templates/.VERSION b/templates/.VERSION
index 32086d73d3..6e4805316a 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.8.3.1214
\ No newline at end of file
+0.8.4.1214
\ No newline at end of file