mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 15:23:33 +01:00
Fix #237
This commit is contained in:
parent
63baf76ab2
commit
11f9d738e8
1 changed files with 24 additions and 6 deletions
|
@ -489,22 +489,40 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
|
|||
// .gitignore
|
||||
if repoLang != "" {
|
||||
filePath := "conf/gitignore/" + repoLang
|
||||
if com.IsFile(filePath) {
|
||||
if err := com.Copy(filePath,
|
||||
filepath.Join(tmpDir, fileName["gitign"])); err != nil {
|
||||
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 err := com.Copy(filePath, targetPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LICENSE
|
||||
if license != "" {
|
||||
filePath := "conf/license/" + license
|
||||
if com.IsFile(filePath) {
|
||||
if err := com.Copy(filePath,
|
||||
filepath.Join(tmpDir, fileName["license"])); err != nil {
|
||||
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 err := com.Copy(filePath, targetPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue