mirror of https://github.com/gogs/gogs.git
vendor: update github.com/gogits/git-module
parent
3b94162803
commit
b3ac33cbcf
|
@ -15,6 +15,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
"github.com/mcuadros/go-version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Repository represents a Git repository.
|
// Repository represents a Git repository.
|
||||||
|
@ -248,6 +249,10 @@ const (
|
||||||
|
|
||||||
// GetRepoSize returns disk usage report of repository in given path.
|
// GetRepoSize returns disk usage report of repository in given path.
|
||||||
func GetRepoSize(repoPath string) (*CountObject, error) {
|
func GetRepoSize(repoPath string) (*CountObject, error) {
|
||||||
|
if version.Compare(gitVersion, "1.8.3", "<") {
|
||||||
|
return nil, ErrUnsupportedVersion{"1.8.3"}
|
||||||
|
}
|
||||||
|
|
||||||
cmd := NewCommand("count-objects", "-v")
|
cmd := NewCommand("count-objects", "-v")
|
||||||
stdout, err := cmd.RunInDir(repoPath)
|
stdout, err := cmd.RunInDir(repoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -262,7 +267,7 @@ func GetRepoSize(repoPath string) (*CountObject, error) {
|
||||||
case strings.HasPrefix(line, _STAT_SIZE):
|
case strings.HasPrefix(line, _STAT_SIZE):
|
||||||
countObject.Size = com.StrTo(line[6:]).MustInt64() * 1024
|
countObject.Size = com.StrTo(line[6:]).MustInt64() * 1024
|
||||||
case strings.HasPrefix(line, _STAT_IN_PACK):
|
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):
|
case strings.HasPrefix(line, _STAT_PACKS):
|
||||||
countObject.Packs = com.StrTo(line[7:]).MustInt64()
|
countObject.Packs = com.StrTo(line[7:]).MustInt64()
|
||||||
case strings.HasPrefix(line, _STAT_SIZE_PACK):
|
case strings.HasPrefix(line, _STAT_SIZE_PACK):
|
||||||
|
|
|
@ -159,10 +159,10 @@
|
||||||
"revisionTime": "2016-08-10T03:50:02Z"
|
"revisionTime": "2016-08-10T03:50:02Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "0BVytmK2I0QObcFqVyVWWU544DA=",
|
"checksumSHA1": "b7QGk00tV65zoJ2LxNOv+/ShNb0=",
|
||||||
"path": "github.com/gogits/git-module",
|
"path": "github.com/gogits/git-module",
|
||||||
"revision": "e0ab95e3e61573e88bb808ae8052fd669324d80f",
|
"revision": "187ba03b3c392ed6e6af3985f0bad0c2120219ca",
|
||||||
"revisionTime": "2017-03-17T02:27:16Z"
|
"revisionTime": "2017-04-01T21:46:49Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",
|
"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",
|
||||||
|
|
Loading…
Reference in New Issue