diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-04-02 10:39:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 10:39:47 +0200 |
commit | 0c2618bc7d495322c6413b0ff62549712747cf9e (patch) | |
tree | 03ddc67b73733d0582367e9038c454353fa55955 /plumbing/transport/test/receive_pack.go | |
parent | 160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff) | |
parent | 6e07548d9078505ca2945f09d11729b14abcc907 (diff) | |
download | go-git-0c2618bc7d495322c6413b0ff62549712747cf9e.tar.gz |
Merge pull request #794 from jfontan/fix/checkclose
Use CheckClose with named returns and fix tests
Diffstat (limited to 'plumbing/transport/test/receive_pack.go')
-rw-r--r-- | plumbing/transport/test/receive_pack.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plumbing/transport/test/receive_pack.go b/plumbing/transport/test/receive_pack.go index a68329e..6179850 100644 --- a/plumbing/transport/test/receive_pack.go +++ b/plumbing/transport/test/receive_pack.go @@ -8,6 +8,8 @@ import ( "context" "io" "io/ioutil" + "os" + "path/filepath" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" @@ -225,6 +227,25 @@ func (s *ReceivePackSuite) receivePackNoCheck(c *C, ep *transport.Endpoint, ep.String(), url, callAdvertisedReferences, ) + // Set write permissions to endpoint directory files. By default + // fixtures are generated with read only permissions, this casuses + // errors deleting or modifying files. + rootPath := ep.Path + println("STAT", rootPath) + stat, err := os.Stat(ep.Path) + + if rootPath != "" && err == nil && stat.IsDir() { + objectPath := filepath.Join(rootPath, "objects/pack") + files, err := ioutil.ReadDir(objectPath) + c.Assert(err, IsNil) + + for _, file := range files { + path := filepath.Join(objectPath, file.Name()) + err = os.Chmod(path, 0644) + c.Assert(err, IsNil) + } + } + r, err := s.Client.NewReceivePackSession(ep, s.EmptyAuth) c.Assert(err, IsNil, comment) defer func() { c.Assert(r.Close(), IsNil, comment) }() |