summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-02-02 23:38:04 -0500
committer无闻 <u@gogs.io>2015-02-02 23:38:04 -0500
commit902f19f70b86888718e8755354a2d3bf6215838e (patch)
treefcc542d1604c46273c7771e584d040e14b2ef46a /models
parentbfce0def25bab777d9287136c60e6e30e9f18591 (diff)
parent44fa9147b76b5500641eecd1be1f76affc8288f8 (diff)
downloadgitea-902f19f70b86888718e8755354a2d3bf6215838e.tar.gz
gitea-902f19f70b86888718e8755354a2d3bf6215838e.zip
Merge pull request #821 from phsmit/fix_819
Fix #819 by fetching the repository from db before updating
Diffstat (limited to 'models')
-rw-r--r--models/repo.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go
index 58c099d490..16b51c47ee 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -504,6 +504,11 @@ func initRepository(f string, u *User, repo *Repository, initReadme bool, repoLa
}
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 _, err := x.Get(repo); err != nil {
+ return err
+ }
repo.IsBare = true
repo.DefaultBranch = "master"
return UpdateRepository(repo)