summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-26 12:26:01 +0800
committerUnknwon <u@gogs.io>2015-08-26 12:26:01 +0800
commitb3a45693c37c94850c0a615b69d19a7e88352348 (patch)
tree2f1e3e251b4ed2bda8eaa77d058cae0f6238294e /models
parent27f7abdd77492e2ccdbfbced859463311daab6f4 (diff)
downloadgitea-b3a45693c37c94850c0a615b69d19a7e88352348.tar.gz
gitea-b3a45693c37c94850c0a615b69d19a7e88352348.zip
minor update
Diffstat (limited to 'models')
-rw-r--r--models/repo.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go
index 9da8ad36ed..61105d84ac 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -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.