Merge pull request #15146 from kolyshkin/mkdirall

Simplify and fix MkdirAll usage
Upstream-commit: 8d2739df980a1af76ad50e5c423134815186b61c
Component: engine
This commit is contained in:
Tibor Vass
2015-07-30 22:40:57 -04:00
9 changed files with 15 additions and 19 deletions
@@ -1187,7 +1187,7 @@ func newFakeGit(name string, files map[string]string, enforceLocalServer bool) (
// Call c.Fatal() at the first error.
func writeFile(dst, content string, c *check.C) {
// Create subdirectories if necessary
if err := os.MkdirAll(path.Dir(dst), 0700); err != nil && !os.IsExist(err) {
if err := os.MkdirAll(path.Dir(dst), 0700); err != nil {
c.Fatal(err)
}
f, err := os.OpenFile(dst, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0700)