1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

minor update

This commit is contained in:
Unknwon
2015-08-26 12:26:01 +08:00
parent 27f7abdd77
commit b3a45693c3
4 changed files with 16 additions and 11 deletions

View File

@@ -575,15 +575,22 @@ func initRepository(e Engine, repoPath string, u *User, repo *Repository, initRe
delete(fileName, "license")
}
// Re-fetch the repository from database before updating it (else it would
// override changes that were done earlier with sql)
if repo, err = getRepositoryByID(e, repo.ID); err != nil {
return fmt.Errorf("getRepositoryByID: %v", err)
}
if len(fileName) == 0 {
// Re-fetch the repository from database before updating it (else it would
// override changes that were done earlier with sql)
if repo, err = getRepositoryByID(e, repo.ID); err != nil {
return err
}
repo.IsBare = true
repo.DefaultBranch = "master"
return updateRepository(e, repo, false)
}
repo.DefaultBranch = "master"
if err = updateRepository(e, repo, false); err != nil {
return fmt.Errorf("updateRepository: %v", err)
}
// Ignore init process if user choose not to.
if len(fileName) == 0 {
return nil
}
// Apply changes and commit.