diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-07-31 18:45:42 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-07-31 12:45:42 -0400 |
commit | a9b4c8171f3b62a951079cdca67e4cf703eb4cc1 (patch) | |
tree | b52f51ec06fb0b91958708b958f7c15c1623e9d1 /vendor/gopkg.in | |
parent | bb875e98a1ee4a30c67a3b879f924e88789baf67 (diff) | |
download | gitea-a9b4c8171f3b62a951079cdca67e4cf703eb4cc1.tar.gz gitea-a9b4c8171f3b62a951079cdca67e4cf703eb4cc1.zip |
Update src-d/go-git to v4.13.0 (#7688)
* update gopkg.in/src-d/go-git.v4 v4.13.0
* mod tidy
* vendor
Diffstat (limited to 'vendor/gopkg.in')
32 files changed, 196 insertions, 91 deletions
diff --git a/vendor/gopkg.in/src-d/go-billy.v4/.gitignore b/vendor/gopkg.in/src-d/go-billy.v4/.gitignore index 62cdb53bc4..7aeb46699c 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/.gitignore +++ b/vendor/gopkg.in/src-d/go-billy.v4/.gitignore @@ -2,4 +2,3 @@ /vendor Gopkg.lock Gopkg.toml -go.sum diff --git a/vendor/gopkg.in/src-d/go-billy.v4/.travis.yml b/vendor/gopkg.in/src-d/go-billy.v4/.travis.yml index 759e2fba82..a70b470d4a 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/.travis.yml +++ b/vendor/gopkg.in/src-d/go-billy.v4/.travis.yml @@ -11,6 +11,7 @@ install: script: - make test-coverage + - ./.ci/test-building-binaries-for-supported-os.sh after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/gopkg.in/src-d/go-billy.v4/README.md b/vendor/gopkg.in/src-d/go-billy.v4/README.md index ef243cca59..ae4a3f8691 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/README.md +++ b/vendor/gopkg.in/src-d/go-billy.v4/README.md @@ -1,4 +1,4 @@ -# go-billy [![GoDoc](https://godoc.org/gopkg.in/src-d/go-billy.v4?status.svg)](https://godoc.org/gopkg.in/src-d/go-billy.v4) [![Build Status](https://travis-ci.org/src-d/go-billy.svg)](https://travis-ci.org/src-d/go-billy) [![Build status](https://ci.appveyor.com/api/projects/status/vx2qn6vlakbi724t?svg=true)](https://ci.appveyor.com/project/mcuadros/go-billy) [![codecov](https://codecov.io/gh/src-d/go-billy/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/go-billy) +# go-billy [![GoDoc](https://godoc.org/gopkg.in/src-d/go-billy.v4?status.svg)](https://godoc.org/gopkg.in/src-d/go-billy.v4) [![Build Status](https://travis-ci.com/src-d/go-billy.svg)](https://travis-ci.com/src-d/go-billy) [![Build status](https://ci.appveyor.com/api/projects/status/vx2qn6vlakbi724t?svg=true)](https://ci.appveyor.com/project/mcuadros/go-billy) [![codecov](https://codecov.io/gh/src-d/go-billy/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/go-billy) The missing interface filesystem abstraction for Go. Billy implements an interface based on the `os` standard library, allowing to develop applications without dependency on the underlying storage. Makes it virtually free to implement mocks and testing over filesystem operations. diff --git a/vendor/gopkg.in/src-d/go-billy.v4/go.mod b/vendor/gopkg.in/src-d/go-billy.v4/go.mod index eec1581118..e5227de0ae 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/go.mod +++ b/vendor/gopkg.in/src-d/go-billy.v4/go.mod @@ -2,6 +2,7 @@ module gopkg.in/src-d/go-billy.v4 require ( github.com/kr/pretty v0.1.0 // indirect - golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 + github.com/kr/pty v1.1.8 // indirect + golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 ) diff --git a/vendor/gopkg.in/src-d/go-billy.v4/go.sum b/vendor/gopkg.in/src-d/go-billy.v4/go.sum index aa96620083..5e9ed217e9 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/go.sum +++ b/vendor/gopkg.in/src-d/go-billy.v4/go.sum @@ -1,9 +1,12 @@ +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 h1:lkiLiLBHGoH3XnqSLUIaBsilGMUjI+Uy2Xu2JLUtTas= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go b/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go index 0eda3bd300..144cde1c18 100644 --- a/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go +++ b/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go @@ -3,19 +3,19 @@ package osfs import ( - "syscall" + "golang.org/x/sys/unix" ) func (f *file) Lock() error { f.m.Lock() defer f.m.Unlock() - return syscall.Flock(int(f.File.Fd()), syscall.LOCK_EX) + return unix.Flock(int(f.File.Fd()), unix.LOCK_EX) } func (f *file) Unlock() error { f.m.Lock() defer f.m.Unlock() - return syscall.Flock(int(f.File.Fd()), syscall.LOCK_UN) + return unix.Flock(int(f.File.Fd()), unix.LOCK_UN) } diff --git a/vendor/gopkg.in/src-d/go-git.v4/blame.go b/vendor/gopkg.in/src-d/go-git.v4/blame.go index adb72d5745..f6108519ad 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/blame.go +++ b/vendor/gopkg.in/src-d/go-git.v4/blame.go @@ -193,7 +193,7 @@ func (b *blame) fillGraphAndData() error { // this first commit. if i == 0 { for j := 0; j < nLines; j++ { - b.graph[i][j] = (*object.Commit)(b.revs[i]) + b.graph[i][j] = b.revs[i] } } else { // if this is not the first commit, then assign to the old @@ -211,7 +211,7 @@ func (b *blame) sliceGraph(i int) []*object.Commit { fVs := b.graph[i] result := make([]*object.Commit, 0, len(fVs)) for _, v := range fVs { - c := object.Commit(*v) + c := *v result = append(result, &c) } return result @@ -234,7 +234,7 @@ func (b *blame) assignOrigin(c, p int) { b.graph[c][dl] = b.graph[p][sl] case hunks[h].Type == 1: dl++ - b.graph[c][dl] = (*object.Commit)(b.revs[c]) + b.graph[c][dl] = b.revs[c] case hunks[h].Type == -1: sl++ default: diff --git a/vendor/gopkg.in/src-d/go-git.v4/config/branch.go b/vendor/gopkg.in/src-d/go-git.v4/config/branch.go index af61bbb9b7..20dde6e030 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/config/branch.go +++ b/vendor/gopkg.in/src-d/go-git.v4/config/branch.go @@ -72,7 +72,7 @@ func (b *Branch) marshal() *format.Subsection { if b.Rebase == "" { b.raw.RemoveOption(rebaseKey) } else { - b.raw.SetOption(rebaseKey, string(b.Rebase)) + b.raw.SetOption(rebaseKey, b.Rebase) } return b.raw diff --git a/vendor/gopkg.in/src-d/go-git.v4/config/refspec.go b/vendor/gopkg.in/src-d/go-git.v4/config/refspec.go index 7f486c9737..14bb40069c 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/config/refspec.go +++ b/vendor/gopkg.in/src-d/go-git.v4/config/refspec.go @@ -18,7 +18,7 @@ var ( ErrRefSpecMalformedWildcard = errors.New("malformed refspec, mismatched number of wildcards") ) -// RefSpec is a mapping from local branches to remote references +// RefSpec is a mapping from local branches to remote references. // The format of the refspec is an optional +, followed by <src>:<dst>, where // <src> is the pattern for references on the remote side and <dst> is where // those references will be written locally. The + tells Git to update the @@ -127,6 +127,13 @@ func (s RefSpec) Dst(n plumbing.ReferenceName) plumbing.ReferenceName { return plumbing.ReferenceName(dst[0:wd] + match + dst[wd+1:]) } +func (s RefSpec) Reverse() RefSpec { + spec := string(s) + separator := strings.Index(spec, refSpecSeparator) + + return RefSpec(spec[separator+1:] + refSpecSeparator + spec[:separator]) +} + func (s RefSpec) String() string { return string(s) } diff --git a/vendor/gopkg.in/src-d/go-git.v4/go.mod b/vendor/gopkg.in/src-d/go-git.v4/go.mod index 60d4702469..6f8b3d2e62 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/go.mod +++ b/vendor/gopkg.in/src-d/go-git.v4/go.mod @@ -4,27 +4,26 @@ require ( github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 // indirect github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 - github.com/davecgh/go-spew v1.1.1 // indirect github.com/emirpasic/gods v1.12.0 github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect - github.com/gliderlabs/ssh v0.1.3 - github.com/google/go-cmp v0.2.0 + github.com/gliderlabs/ssh v0.2.2 + github.com/google/go-cmp v0.3.0 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 github.com/jessevdk/go-flags v1.4.0 - github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e + github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd github.com/mitchellh/go-homedir v1.1.0 github.com/pelletier/go-buffruneio v0.2.0 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/sergi/go-diff v1.0.0 github.com/src-d/gcfg v1.4.0 - github.com/stretchr/testify v1.3.0 // indirect + github.com/stretchr/objx v0.2.0 // indirect github.com/xanzy/ssh-agent v0.2.1 - golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd - golang.org/x/net v0.0.0-20190502183928-7f726cade0ab - golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect - golang.org/x/text v0.3.0 + golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 + golang.org/x/text v0.3.2 + golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a // indirect gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 - gopkg.in/src-d/go-billy.v4 v4.3.0 + gopkg.in/src-d/go-billy.v4 v4.3.2 gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 gopkg.in/warnings.v0 v0.1.2 // indirect ) diff --git a/vendor/gopkg.in/src-d/go-git.v4/go.sum b/vendor/gopkg.in/src-d/go-git.v4/go.sum index 94a6142432..65551c1658 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/go.sum +++ b/vendor/gopkg.in/src-d/go-git.v4/go.sum @@ -4,6 +4,7 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,17 +14,23 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gliderlabs/ssh v0.1.3 h1:cBU46h1lYQk5f2Z+jZbewFKy+1zzE2aUX/ilcPDAm9M= github.com/gliderlabs/ssh v0.1.3/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= +github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8= github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY= +github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -39,6 +46,7 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= @@ -47,11 +55,17 @@ golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd h1:sMHc2rZHuzQmrbVoSpt9HgerkXPyIeCSO6k0zUMGfFk= golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190420063019-afa5a82059c6 h1:HdqqaWmYAUI7/dmByKKEw+yxDksGSo+9GjkUc9Zp34E= golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190502183928-7f726cade0ab h1:9RfW3ktsOZxgo9YNbBAjq1FWzc/igwEcUzZz8IXgSbk= golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 h1:lkiLiLBHGoH3XnqSLUIaBsilGMUjI+Uy2Xu2JLUtTas= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -59,12 +73,19 @@ golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= +gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg= +gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg= gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= diff --git a/vendor/gopkg.in/src-d/go-git.v4/options.go b/vendor/gopkg.in/src-d/go-git.v4/options.go index a3b14fe2de..0f728e7c27 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/options.go +++ b/vendor/gopkg.in/src-d/go-git.v4/options.go @@ -186,6 +186,9 @@ type PushOptions struct { // Progress is where the human readable information sent by the server is // stored, if nil nothing is stored. Progress sideband.Progress + // Prune specify that remote refs that match given RefSpecs and that do + // not exist locally will be removed. + Prune bool } // Validate validates the fields and sets the default values. diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/encoder.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/encoder.go index a06871cb7c..615e833c1e 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/encoder.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/encoder.go @@ -24,8 +24,6 @@ func NewEncoder(w io.Writer) *Encoder { // Encode writes an index into the commit-graph file
func (e *Encoder) Encode(idx Index) error {
- var err error
-
// Get all the hashes in the input index
hashes := idx.Hashes()
@@ -39,26 +37,26 @@ func (e *Encoder) Encode(idx Index) error { chunkSizes = append(chunkSizes, uint64(extraEdgesCount)*4)
}
- if err = e.encodeFileHeader(len(chunkSignatures)); err != nil {
+ if err := e.encodeFileHeader(len(chunkSignatures)); err != nil {
return err
}
- if err = e.encodeChunkHeaders(chunkSignatures, chunkSizes); err != nil {
+ if err := e.encodeChunkHeaders(chunkSignatures, chunkSizes); err != nil {
return err
}
- if err = e.encodeFanout(fanout); err != nil {
+ if err := e.encodeFanout(fanout); err != nil {
return err
}
- if err = e.encodeOidLookup(hashes); err != nil {
+ if err := e.encodeOidLookup(hashes); err != nil {
return err
}
if extraEdges, err := e.encodeCommitData(hashes, hashToIndex, idx); err == nil {
if err = e.encodeExtraEdges(extraEdges); err != nil {
return err
}
- }
- if err != nil {
+ } else {
return err
}
+
return e.encodeChecksum()
}
diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/file.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/file.go index 175d279333..1f82abd754 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/file.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/file.go @@ -249,7 +249,7 @@ func (fi *fileIndex) getHashesFromIndexes(indexes []int) ([]plumbing.Hash, error // Hashes returns all the hashes that are available in the index
func (fi *fileIndex) Hashes() []plumbing.Hash {
hashes := make([]plumbing.Hash, fi.fanout[0xff])
- for i := 0; i < int(fi.fanout[0xff]); i++ {
+ for i := 0; i < fi.fanout[0xff]; i++ {
offset := fi.oidLookupOffset + int64(i)*20
if n, err := fi.reader.ReadAt(hashes[i][:], offset); err != nil || n < 20 {
return nil
diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/memory.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/memory.go index a4a96e9612..f5afd4c598 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/memory.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph/memory.go @@ -31,7 +31,7 @@ func (mi *MemoryIndex) GetIndexByHash(h plumbing.Hash) (int, error) { // GetCommitDataByIndex gets the commit node from the commit graph using index
// obtained from child node, if available
func (mi *MemoryIndex) GetCommitDataByIndex(i int) (*CommitData, error) {
- if int(i) >= len(mi.commitData) {
+ if i >= len(mi.commitData) {
return nil, plumbing.ErrObjectNotFound
}
diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go index 8bd6d8abc8..169242dc5b 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/diff/unified_encoder.go @@ -94,7 +94,7 @@ func (e *UnifiedEncoder) printMessage(message string) { isEmpty := message == "" hasSuffix := strings.HasSuffix(message, "\n") if !isEmpty && !hasSuffix { - message = message + "\n" + message += "\n" } e.buf.WriteString(message) diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/decoder.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/decoder.go index 5b927826a1..9e9c1769ab 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/decoder.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/decoder.go @@ -110,10 +110,6 @@ func readObjectNames(idx *MemoryIndex, r io.Reader) error { continue } - if buckets < 0 { - return ErrMalformedIdxFile - } - idx.FanoutMapping[k] = len(idx.Names) nameLen := int(buckets * objectIDLength) diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/writer.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/writer.go index aa919e783b..fcc78c56d0 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/writer.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/idxfile/writer.go @@ -147,7 +147,7 @@ func (w *Writer) createIndex() (*MemoryIndex, error) { idx.Offset32[bucket] = append(idx.Offset32[bucket], buf.Bytes()...) buf.Truncate(0) - binary.WriteUint32(buf, uint32(o.CRC32)) + binary.WriteUint32(buf, o.CRC32) idx.CRC32[bucket] = append(idx.CRC32[bucket], buf.Bytes()...) } diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/doc.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/doc.go index f2b3d76cdc..39ae6ad5f9 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/doc.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/doc.go @@ -320,7 +320,7 @@ // == End of Index Entry // // The End of Index Entry (EOIE) is used to locate the end of the variable -// length index entries and the begining of the extensions. Code can take +// length index entries and the beginning of the extensions. Code can take // advantage of this to quickly locate the index extensions without having // to parse through all of the index entries. // @@ -353,7 +353,7 @@ // // - A number of index offset entries each consisting of: // -// - 32-bit offset from the begining of the file to the first cache entry +// - 32-bit offset from the beginning of the file to the first cache entry // in this block of entries. // // - 32-bit count of cache entries in this blockpackage index diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/index.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/index.go index 6c4b7ca745..6653c91d2b 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/index.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/format/index/index.go @@ -198,7 +198,7 @@ type ResolveUndoEntry struct { } // EndOfIndexEntry is the End of Index Entry (EOIE) is used to locate the end of -// the variable length index entries and the begining of the extensions. Code +// the variable length index entries and the beginning of the extensions. Code // can take advantage of this to quickly locate the index extensions without // having to parse through all of the index entries. // diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/merge_base.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/merge_base.go index 689e4217d0..6f2568dbc8 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/merge_base.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/merge_base.go @@ -32,7 +32,7 @@ func (c *Commit) MergeBase(other *Commit) ([]*Commit, error) { var res []*Commit inNewerHistory := isInIndexCommitFilter(newerHistory) resIter := NewFilterCommitIter(older, &inNewerHistory, &inNewerHistory) - err = resIter.ForEach(func(commit *Commit) error { + _ = resIter.ForEach(func(commit *Commit) error { res = append(res, commit) return nil }) diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go index 1efd0b13da..32454ac48d 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go @@ -278,7 +278,7 @@ func printStat(fileStats []FileStat) string { var scaleFactor float64 if longestTotalChange > heightOfHistogram { // Scale down to heightOfHistogram. - scaleFactor = float64(longestTotalChange / heightOfHistogram) + scaleFactor = longestTotalChange / heightOfHistogram } else { scaleFactor = 1.0 } diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/tree.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/tree.go index d30cf6e1aa..d0b4fff15c 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/tree.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/object/tree.go @@ -288,7 +288,7 @@ func (t *Tree) Encode(o plumbing.EncodedObject) (err error) { return err } - if _, err = w.Write([]byte(entry.Hash[:])); err != nil { + if _, err = w.Write(entry.Hash[:]); err != nil { return err } } @@ -517,4 +517,4 @@ func simpleJoin(parent, child string) string { return parent + "/" + child } return child -}
\ No newline at end of file +} diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/advrefs.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/advrefs.go index 684e76a56e..487ee19bd8 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/advrefs.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/advrefs.go @@ -107,7 +107,7 @@ func (a *AdvRefs) resolveHead(s storer.ReferenceStorer) error { return nil } - ref, err := s.Reference(plumbing.ReferenceName(plumbing.Master)) + ref, err := s.Reference(plumbing.Master) // check first if HEAD is pointing to master if err == nil { diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/updreq_decode.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/updreq_decode.go index c15d49cfb7..51e8183d1f 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/updreq_decode.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/updreq_decode.go @@ -225,7 +225,7 @@ func parseCommand(b []byte) (*Command, error) { return nil, errInvalidNewObjId(err) } - return &Command{Old: oh, New: nh, Name: plumbing.ReferenceName(n)}, nil + return &Command{Old: oh, New: nh, Name: n}, nil } func parseHash(s string) (plumbing.Hash, error) { diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/http/common.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/http/common.go index 5d3535e822..38e903d456 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/http/common.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/http/common.go @@ -139,7 +139,7 @@ func (s *session) ApplyAuthToRequest(req *http.Request) { return } - s.auth.setAuth(req) + s.auth.SetAuth(req) } func (s *session) ModifyEndpointIfRedirect(res *http.Response) { @@ -175,7 +175,7 @@ func (*session) Close() error { // AuthMethod is concrete implementation of common.AuthMethod for HTTP services type AuthMethod interface { transport.AuthMethod - setAuth(r *http.Request) + SetAuth(r *http.Request) } func basicAuthFromEndpoint(ep *transport.Endpoint) *BasicAuth { @@ -192,7 +192,7 @@ type BasicAuth struct { Username, Password string } -func (a *BasicAuth) setAuth(r *http.Request) { +func (a *BasicAuth) SetAuth(r *http.Request) { if a == nil { return } @@ -226,7 +226,7 @@ type TokenAuth struct { Token string } -func (a *TokenAuth) setAuth(r *http.Request) { +func (a *TokenAuth) SetAuth(r *http.Request) { if a == nil { return } diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/server/server.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/server/server.go index 20bd12e211..8e0dcc1192 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/server/server.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/server/server.go @@ -286,11 +286,6 @@ func (s *rpSession) updateReferences(req *packp.ReferenceUpdateRequest) { continue } - if err != nil { - s.setStatus(cmd.Name, err) - continue - } - ref := plumbing.NewHashReference(cmd.Name, cmd.New) err := s.storer.SetReference(ref) s.setStatus(cmd.Name, err) diff --git a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/auth_method.go b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/auth_method.go index dbb47c56bb..1e5c38375e 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/auth_method.go +++ b/vendor/gopkg.in/src-d/go-git.v4/plumbing/transport/ssh/auth_method.go @@ -61,7 +61,7 @@ func (a *KeyboardInteractive) ClientConfig() (*ssh.ClientConfig, error) { return a.SetHostKeyCallback(&ssh.ClientConfig{ User: a.User, Auth: []ssh.AuthMethod{ - ssh.KeyboardInteractiveChallenge(a.Challenge), + a.Challenge, }, }) } diff --git a/vendor/gopkg.in/src-d/go-git.v4/remote.go b/vendor/gopkg.in/src-d/go-git.v4/remote.go index bcc4c4c49b..baee7a0826 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/remote.go +++ b/vendor/gopkg.in/src-d/go-git.v4/remote.go @@ -171,7 +171,17 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) { } } - rs, err := pushHashes(ctx, s, r.s, req, hashesToPush, r.useRefDeltas(ar)) + if len(hashesToPush) == 0 { + allDelete = true + for _, command := range req.Commands { + if command.Action() != packp.Delete { + allDelete = false + break + } + } + } + + rs, err := pushHashes(ctx, s, r.s, req, hashesToPush, r.useRefDeltas(ar), allDelete) if err != nil { return err } @@ -204,7 +214,7 @@ func (r *Remote) newReferenceUpdateRequest( } } - if err := r.addReferencesToUpdate(o.RefSpecs, localRefs, remoteRefs, req); err != nil { + if err := r.addReferencesToUpdate(o.RefSpecs, localRefs, remoteRefs, req, o.Prune); err != nil { return nil, err } @@ -392,6 +402,7 @@ func (r *Remote) addReferencesToUpdate( localRefs []*plumbing.Reference, remoteRefs storer.ReferenceStorer, req *packp.ReferenceUpdateRequest, + prune bool, ) error { // This references dictionary will be used to search references by name. refsDict := make(map[string]*plumbing.Reference) @@ -401,7 +412,7 @@ func (r *Remote) addReferencesToUpdate( for _, rs := range refspecs { if rs.IsDelete() { - if err := r.deleteReferences(rs, remoteRefs, req); err != nil { + if err := r.deleteReferences(rs, remoteRefs, refsDict, req, false); err != nil { return err } } else { @@ -409,6 +420,12 @@ func (r *Remote) addReferencesToUpdate( if err != nil { return err } + + if prune { + if err := r.deleteReferences(rs, remoteRefs, refsDict, req, true); err != nil { + return err + } + } } } @@ -444,7 +461,10 @@ func (r *Remote) addOrUpdateReferences( } func (r *Remote) deleteReferences(rs config.RefSpec, - remoteRefs storer.ReferenceStorer, req *packp.ReferenceUpdateRequest) error { + remoteRefs storer.ReferenceStorer, + refsDict map[string]*plumbing.Reference, + req *packp.ReferenceUpdateRequest, + prune bool) error { iter, err := remoteRefs.IterReferences() if err != nil { return err @@ -455,8 +475,19 @@ func (r *Remote) deleteReferences(rs config.RefSpec, return nil } - if rs.Dst("") != ref.Name() { - return nil + if prune { + rs := rs.Reverse() + if !rs.Match(ref.Name()) { + return nil + } + + if _, ok := refsDict[rs.Dst(ref.Name()).String()]; ok { + return nil + } + } else { + if rs.Dst("") != ref.Name() { + return nil + } } cmd := &packp.Command{ @@ -906,7 +937,7 @@ func (r *Remote) updateLocalReferenceStorage( updated = true } - if err == nil && forceNeeded { + if forceNeeded { err = ErrForceNeeded } @@ -1015,10 +1046,11 @@ func pushHashes( req *packp.ReferenceUpdateRequest, hs []plumbing.Hash, useRefDeltas bool, + allDelete bool, ) (*packp.ReportStatus, error) { rd, wr := io.Pipe() - req.Packfile = rd + config, err := s.Config() if err != nil { return nil, err @@ -1029,15 +1061,20 @@ func pushHashes( // to the channel. done := make(chan error, 1) - go func() { - e := packfile.NewEncoder(wr, s, useRefDeltas) - if _, err := e.Encode(hs, config.Pack.Window); err != nil { - done <- wr.CloseWithError(err) - return - } + if !allDelete { + req.Packfile = rd + go func() { + e := packfile.NewEncoder(wr, s, useRefDeltas) + if _, err := e.Encode(hs, config.Pack.Window); err != nil { + done <- wr.CloseWithError(err) + return + } - done <- wr.Close() - }() + done <- wr.Close() + }() + } else { + close(done) + } rs, err := sess.ReceivePack(ctx, req) if err != nil { diff --git a/vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/index.go b/vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/index.go index d04195ccba..be800eff3b 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/index.go +++ b/vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/index.go @@ -20,8 +20,14 @@ func (s *IndexStorage) SetIndex(idx *index.Index) (err error) { } defer ioutil.CheckClose(f, &err) + bw := bufio.NewWriter(f) + defer func() { + if e := bw.Flush(); err == nil && e != nil { + err = e + } + }() - e := index.NewEncoder(f) + e := index.NewEncoder(bw) err = e.Encode(idx) return err } diff --git a/vendor/gopkg.in/src-d/go-git.v4/worktree.go b/vendor/gopkg.in/src-d/go-git.v4/worktree.go index 576ae0abde..4a609e9eab 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/worktree.go +++ b/vendor/gopkg.in/src-d/go-git.v4/worktree.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "strings" + "sync" "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" @@ -304,6 +305,7 @@ func (w *Worktree) resetIndex(t *object.Tree) error { if err != nil { return err } + b := newIndexBuilder(idx) changes, err := w.diffTreeWithStaging(t, true) if err != nil { @@ -330,12 +332,12 @@ func (w *Worktree) resetIndex(t *object.Tree) error { name = ch.From.String() } - _, _ = idx.Remove(name) + b.Remove(name) if e == nil { continue } - idx.Entries = append(idx.Entries, &index.Entry{ + b.Add(&index.Entry{ Name: name, Hash: e.Hash, Mode: e.Mode, @@ -343,6 +345,7 @@ func (w *Worktree) resetIndex(t *object.Tree) error { } + b.Write(idx) return w.r.Storer.SetIndex(idx) } @@ -356,17 +359,19 @@ func (w *Worktree) resetWorktree(t *object.Tree) error { if err != nil { return err } + b := newIndexBuilder(idx) for _, ch := range changes { - if err := w.checkoutChange(ch, t, idx); err != nil { + if err := w.checkoutChange(ch, t, b); err != nil { return err } } + b.Write(idx) return w.r.Storer.SetIndex(idx) } -func (w *Worktree) checkoutChange(ch merkletrie.Change, t *object.Tree, idx *index.Index) error { +func (w *Worktree) checkoutChange(ch merkletrie.Change, t *object.Tree, idx *indexBuilder) error { a, err := ch.Action() if err != nil { return err @@ -445,7 +450,7 @@ func (w *Worktree) setHEADCommit(commit plumbing.Hash) error { func (w *Worktree) checkoutChangeSubmodule(name string, a merkletrie.Action, e *object.TreeEntry, - idx *index.Index, + idx *indexBuilder, ) error { switch a { case merkletrie.Modify: @@ -479,11 +484,11 @@ func (w *Worktree) checkoutChangeRegularFile(name string, a merkletrie.Action, t *object.Tree, e *object.TreeEntry, - idx *index.Index, + idx *indexBuilder, ) error { switch a { case merkletrie.Modify: - _, _ = idx.Remove(name) + idx.Remove(name) // to apply perm changes the file is deleted, billy doesn't implement // chmod @@ -508,6 +513,12 @@ func (w *Worktree) checkoutChangeRegularFile(name string, return nil } +var copyBufferPool = sync.Pool{ + New: func() interface{} { + return make([]byte, 32*1024) + }, +} + func (w *Worktree) checkoutFile(f *object.File) (err error) { mode, err := f.Mode.ToOSFileMode() if err != nil { @@ -531,8 +542,9 @@ func (w *Worktree) checkoutFile(f *object.File) (err error) { } defer ioutil.CheckClose(to, &err) - - _, err = io.Copy(to, from) + buf := copyBufferPool.Get().([]byte) + _, err = io.CopyBuffer(to, from, buf) + copyBufferPool.Put(buf) return } @@ -569,19 +581,18 @@ func (w *Worktree) checkoutFileSymlink(f *object.File) (err error) { return } -func (w *Worktree) addIndexFromTreeEntry(name string, f *object.TreeEntry, idx *index.Index) error { - _, _ = idx.Remove(name) - idx.Entries = append(idx.Entries, &index.Entry{ +func (w *Worktree) addIndexFromTreeEntry(name string, f *object.TreeEntry, idx *indexBuilder) error { + idx.Remove(name) + idx.Add(&index.Entry{ Hash: f.Hash, Name: name, Mode: filemode.Submodule, }) - return nil } -func (w *Worktree) addIndexFromFile(name string, h plumbing.Hash, idx *index.Index) error { - _, _ = idx.Remove(name) +func (w *Worktree) addIndexFromFile(name string, h plumbing.Hash, idx *indexBuilder) error { + idx.Remove(name) fi, err := w.Filesystem.Lstat(name) if err != nil { return err @@ -605,8 +616,7 @@ func (w *Worktree) addIndexFromFile(name string, h plumbing.Hash, idx *index.Ind if fillSystemInfo != nil { fillSystemInfo(e, fi.Sys()) } - - idx.Entries = append(idx.Entries, e) + idx.Add(e) return nil } @@ -913,3 +923,32 @@ func doCleanDirectories(fs billy.Filesystem, dir string) error { } return nil } + +type indexBuilder struct { + entries map[string]*index.Entry +} + +func newIndexBuilder(idx *index.Index) *indexBuilder { + entries := make(map[string]*index.Entry, len(idx.Entries)) + for _, e := range idx.Entries { + entries[e.Name] = e + } + return &indexBuilder{ + entries: entries, + } +} + +func (b *indexBuilder) Write(idx *index.Index) { + idx.Entries = idx.Entries[:0] + for _, e := range b.entries { + idx.Entries = append(idx.Entries, e) + } +} + +func (b *indexBuilder) Add(e *index.Entry) { + b.entries[e.Name] = e +} + +func (b *indexBuilder) Remove(name string) { + delete(b.entries, filepath.ToSlash(name)) +} diff --git a/vendor/gopkg.in/src-d/go-git.v4/worktree_linux.go b/vendor/gopkg.in/src-d/go-git.v4/worktree_linux.go index 891cb1cf39..efb01b5a58 100644 --- a/vendor/gopkg.in/src-d/go-git.v4/worktree_linux.go +++ b/vendor/gopkg.in/src-d/go-git.v4/worktree_linux.go @@ -12,7 +12,7 @@ import ( func init() { fillSystemInfo = func(e *index.Entry, sys interface{}) { if os, ok := sys.(*syscall.Stat_t); ok { - e.CreatedAt = time.Unix(int64(os.Ctim.Sec), int64(os.Ctim.Nsec)) + e.CreatedAt = time.Unix(os.Ctim.Sec, os.Ctim.Nsec) e.Dev = uint32(os.Dev) e.Inode = uint32(os.Ino) e.GID = os.Gid |