diff options
author | Peter Smit <peter@smitmail.eu> | 2015-01-02 11:15:42 +0200 |
---|---|---|
committer | Peter Smit <peter@smitmail.eu> | 2015-01-02 11:15:42 +0200 |
commit | 44fa9147b76b5500641eecd1be1f76affc8288f8 (patch) | |
tree | b7cb3c4413c442b84410207448bdb43613aa1ee0 | |
parent | b6272d180343d8081941eb56f22fed5ffc830a7e (diff) | |
download | gitea-44fa9147b76b5500641eecd1be1f76affc8288f8.tar.gz gitea-44fa9147b76b5500641eecd1be1f76affc8288f8.zip |
Fix #819 by fetching the repository from db before updating
-rw-r--r-- | models/repo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 50b2b3fc25..495f1660c7 100644 --- a/models/repo.go +++ b/models/repo.go @@ -507,6 +507,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) |