Browse Source

vendor: update github.com/gogits/git-module

Unknwon 7 years ago
parent
commit
17d2a9c435
4 changed files with 14 additions and 9 deletions
  1. 1 1
      gogs.go
  2. 1 1
      templates/.VERSION
  3. 9 4
      vendor/github.com/gogits/git-module/blob.go
  4. 3 3
      vendor/vendor.json

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/gogits/gogs/pkg/setting"
 	"github.com/gogits/gogs/pkg/setting"
 )
 )
 
 
-const APP_VER = "0.11.34.1122"
+const APP_VER = "0.11.34.0302"
 
 
 func init() {
 func init() {
 	setting.AppVer = APP_VER
 	setting.AppVer = APP_VER

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.11.34.1122
+0.11.34.0302

+ 9 - 4
vendor/github.com/gogits/git-module/blob.go

@@ -18,11 +18,16 @@ type Blob struct {
 // Data gets content of blob all at once and wrap it as io.Reader.
 // Data gets content of blob all at once and wrap it as io.Reader.
 // This can be very slow and memory consuming for huge content.
 // This can be very slow and memory consuming for huge content.
 func (b *Blob) Data() (io.Reader, error) {
 func (b *Blob) Data() (io.Reader, error) {
-	stdout, err := NewCommand("show", b.ID.String()).RunInDirBytes(b.repo.Path)
-	if err != nil {
-		return nil, err
+	stdout := new(bytes.Buffer)
+	stderr := new(bytes.Buffer)
+
+	// Preallocate memory to save ~50% memory usage on big files.
+	stdout.Grow(int(b.Size() + 2048))
+
+	if err := b.DataPipeline(stdout, stderr); err != nil {
+		return nil, concatenateError(err, stderr.String())
 	}
 	}
-	return bytes.NewBuffer(stdout), nil
+	return stdout, nil
 }
 }
 
 
 func (b *Blob) DataPipeline(stdout, stderr io.Writer) error {
 func (b *Blob) DataPipeline(stdout, stderr io.Writer) error {

+ 3 - 3
vendor/vendor.json

@@ -183,10 +183,10 @@
 			"revisionTime": "2016-08-10T03:50:02Z"
 			"revisionTime": "2016-08-10T03:50:02Z"
 		},
 		},
 		{
 		{
-			"checksumSHA1": "baBdY7sA0U60da7wfhIialHmMwU=",
+			"checksumSHA1": "uKdOeK8zCfl5p7pZTRiZqDO2Tns=",
 			"path": "github.com/gogits/git-module",
 			"path": "github.com/gogits/git-module",
-			"revision": "5cc36acd9bc119acc0376a4db452e8ce55451c9f",
-			"revisionTime": "2017-11-16T18:10:54Z"
+			"revision": "e76267f9b4e90e15a82189b72aae8bf1c799c52a",
+			"revisionTime": "2018-03-02T07:13:32Z"
 		},
 		},
 		{
 		{
 			"checksumSHA1": "GBfb+meRaVNarQavLB/bzbDoBtY=",
 			"checksumSHA1": "GBfb+meRaVNarQavLB/bzbDoBtY=",