0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-19 16:31:41 +01:00

Make sure .git/info is created before generating .git/info/sparse-che… (#5825)

* Make sure .git/info is created before generating .git/info/sparse-checkout

* fix permissions
This commit is contained in:
Mura Li 2019-01-24 15:43:37 +08:00 committed by Lauris BH
parent 88aa70bab9
commit ec31ee1c1c

View file

@ -447,7 +447,11 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
return fmt.Errorf("getDiffTree: %v", err)
}
sparseCheckoutListPath := filepath.Join(tmpBasePath, ".git", "info", "sparse-checkout")
infoPath := filepath.Join(tmpBasePath, ".git", "info")
if err := os.MkdirAll(infoPath, 0700); err != nil {
return fmt.Errorf("creating directory failed [%s]: %v", infoPath, err)
}
sparseCheckoutListPath := filepath.Join(infoPath, "sparse-checkout")
if err := ioutil.WriteFile(sparseCheckoutListPath, []byte(sparseCheckoutList), 0600); err != nil {
return fmt.Errorf("Writing sparse-checkout file to %s: %v", sparseCheckoutListPath, err)
}