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

This commit is contained in:
Unknwon
2017-04-01 17:50:11 -04:00
parent 3b94162803
commit b3ac33cbcf
2 changed files with 9 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ import (
"time"
"github.com/Unknwon/com"
"github.com/mcuadros/go-version"
)
// Repository represents a Git repository.
@@ -248,6 +249,10 @@ const (
// GetRepoSize returns disk usage report of repository in given path.
func GetRepoSize(repoPath string) (*CountObject, error) {
if version.Compare(gitVersion, "1.8.3", "<") {
return nil, ErrUnsupportedVersion{"1.8.3"}
}
cmd := NewCommand("count-objects", "-v")
stdout, err := cmd.RunInDir(repoPath)
if err != nil {
@@ -262,7 +267,7 @@ func GetRepoSize(repoPath string) (*CountObject, error) {
case strings.HasPrefix(line, _STAT_SIZE):
countObject.Size = com.StrTo(line[6:]).MustInt64() * 1024
case strings.HasPrefix(line, _STAT_IN_PACK):
countObject.InPack = com.StrTo(line[9:]).MustInt64() * 1024
countObject.InPack = com.StrTo(line[9:]).MustInt64()
case strings.HasPrefix(line, _STAT_PACKS):
countObject.Packs = com.StrTo(line[7:]).MustInt64()
case strings.HasPrefix(line, _STAT_SIZE_PACK):