|
8 | 8 | "context" |
9 | 9 | "io" |
10 | 10 | "io/ioutil" |
| 11 | + "os" |
| 12 | + "path/filepath" |
11 | 13 |
|
12 | 14 | "gopkg.in/src-d/go-git.v4/plumbing" |
13 | 15 | "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" |
@@ -225,6 +227,25 @@ func (s *ReceivePackSuite) receivePackNoCheck(c *C, ep *transport.Endpoint, |
225 | 227 | ep.String(), url, callAdvertisedReferences, |
226 | 228 | ) |
227 | 229 |
|
| 230 | + // Set write permissions to endpoint directory files. By default |
| 231 | + // fixtures are generated with read only permissions, this casuses |
| 232 | + // errors deleting or modifying files. |
| 233 | + rootPath := ep.Path |
| 234 | + println("STAT", rootPath) |
| 235 | + stat, err := os.Stat(ep.Path) |
| 236 | + |
| 237 | + if rootPath != "" && err == nil && stat.IsDir() { |
| 238 | + objectPath := filepath.Join(rootPath, "objects/pack") |
| 239 | + files, err := ioutil.ReadDir(objectPath) |
| 240 | + c.Assert(err, IsNil) |
| 241 | + |
| 242 | + for _, file := range files { |
| 243 | + path := filepath.Join(objectPath, file.Name()) |
| 244 | + err = os.Chmod(path, 0644) |
| 245 | + c.Assert(err, IsNil) |
| 246 | + } |
| 247 | + } |
| 248 | + |
228 | 249 | r, err := s.Client.NewReceivePackSession(ep, s.EmptyAuth) |
229 | 250 | c.Assert(err, IsNil, comment) |
230 | 251 | defer func() { c.Assert(r.Close(), IsNil, comment) }() |
|
0 commit comments