tokarchuk/v1.17
Unknown 11 years ago
parent 63baf76ab2
commit 11f9d738e8
  1. 26
      models/repo.go

@ -489,24 +489,42 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
// .gitignore // .gitignore
if repoLang != "" { if repoLang != "" {
filePath := "conf/gitignore/" + repoLang filePath := "conf/gitignore/" + repoLang
targetPath := path.Join(tmpDir, fileName["gitign"])
data, err := bin.Asset(filePath)
if err == nil {
if err = ioutil.WriteFile(targetPath, data, os.ModePerm); err != nil {
return err
}
} else {
// Check custom files.
filePath = path.Join(setting.CustomPath, "conf/gitignore", repoLang)
if com.IsFile(filePath) { if com.IsFile(filePath) {
if err := com.Copy(filePath, if err := com.Copy(filePath, targetPath); err != nil {
filepath.Join(tmpDir, fileName["gitign"])); err != nil {
return err return err
} }
} }
} }
}
// LICENSE // LICENSE
if license != "" { if license != "" {
filePath := "conf/license/" + license filePath := "conf/license/" + license
targetPath := path.Join(tmpDir, fileName["license"])
data, err := bin.Asset(filePath)
if err == nil {
if err = ioutil.WriteFile(targetPath, data, os.ModePerm); err != nil {
return err
}
} else {
// Check custom files.
filePath = path.Join(setting.CustomPath, "conf/license", license)
if com.IsFile(filePath) { if com.IsFile(filePath) {
if err := com.Copy(filePath, if err := com.Copy(filePath, targetPath); err != nil {
filepath.Join(tmpDir, fileName["license"])); err != nil {
return err return err
} }
} }
} }
}
if len(fileName) == 0 { if len(fileName) == 0 {
return nil return nil

Loading…
Cancel
Save