mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix #237
This commit is contained in:
		@@ -489,22 +489,40 @@ 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
 | 
				
			||||||
		if com.IsFile(filePath) {
 | 
							targetPath := path.Join(tmpDir, fileName["gitign"])
 | 
				
			||||||
			if err := com.Copy(filePath,
 | 
							data, err := bin.Asset(filePath)
 | 
				
			||||||
				filepath.Join(tmpDir, fileName["gitign"])); err != nil {
 | 
							if err == nil {
 | 
				
			||||||
 | 
								if err = ioutil.WriteFile(targetPath, data, os.ModePerm); err != nil {
 | 
				
			||||||
				return err
 | 
									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
 | 
						// LICENSE
 | 
				
			||||||
	if license != "" {
 | 
						if license != "" {
 | 
				
			||||||
		filePath := "conf/license/" + license
 | 
							filePath := "conf/license/" + license
 | 
				
			||||||
		if com.IsFile(filePath) {
 | 
							targetPath := path.Join(tmpDir, fileName["license"])
 | 
				
			||||||
			if err := com.Copy(filePath,
 | 
							data, err := bin.Asset(filePath)
 | 
				
			||||||
				filepath.Join(tmpDir, fileName["license"])); err != nil {
 | 
							if err == nil {
 | 
				
			||||||
 | 
								if err = ioutil.WriteFile(targetPath, data, os.ModePerm); err != nil {
 | 
				
			||||||
				return err
 | 
									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
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user