From 44fa9147b76b5500641eecd1be1f76affc8288f8 Mon Sep 17 00:00:00 2001 From: Peter Smit Date: Fri, 2 Jan 2015 11:15:42 +0200 Subject: [PATCH] Fix #819 by fetching the repository from db before updating --- models/repo.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/repo.go b/models/repo.go index 50b2b3fc25e8..495f1660c75b 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)