diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-05 19:40:01 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-05 19:40:01 -0400 |
commit | fa0a389dc47c3e2b6203157f5c377a6478da25ec (patch) | |
tree | ddc4bc59b5e042bf287719031fdbaddf6c8854ff /models | |
parent | 6f6fda1481fc299bbdf3c1106ee6474f8b614fa2 (diff) | |
download | gitea-fa0a389dc47c3e2b6203157f5c377a6478da25ec.tar.gz gitea-fa0a389dc47c3e2b6203157f5c377a6478da25ec.zip |
Fix bare repo bug
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go index a68757af31..c2398fe7da 100644 --- a/models/repo.go +++ b/models/repo.go @@ -446,7 +446,9 @@ func initRepository(f string, u *User, repo *Repository, initReadme bool, repoLa } if len(fileName) == 0 { - return nil + repo.IsBare = true + repo.DefaultBranch = "master" + return UpdateRepository(repo) } // Apply changes and commit. @@ -479,10 +481,6 @@ func CreateRepository(u *User, name, desc, lang, license string, private, mirror LowerName: strings.ToLower(name), Description: desc, IsPrivate: private, - IsBare: lang == "" && license == "" && !initReadme, - } - if !repo.IsBare { - repo.DefaultBranch = "master" } if _, err = sess.Insert(repo); err != nil { @@ -550,11 +548,11 @@ func CreateRepository(u *User, name, desc, lang, license string, private, mirror if u.IsOrganization() { ous, err := GetOrgUsersByOrgId(u.Id) if err != nil { - log.Error(4, "repo.CreateRepository(GetOrgUsersByOrgId): %v", err) + log.Error(4, "GetOrgUsersByOrgId: %v", err) } else { for _, ou := range ous { if err = WatchRepo(ou.Uid, repo.Id, true); err != nil { - log.Error(4, "repo.CreateRepository(WatchRepo): %v", err) + log.Error(4, "WatchRepo: %v", err) } } } |