diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-01 12:03:10 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-01 12:03:10 -0400 |
commit | 75109bbd653f69e4a924b6654e564341e4bcf229 (patch) | |
tree | fa3a334790fc5ed244ffa9fd0fff6ea8733a3a25 /models | |
parent | 0a187dbef5d2480f8d47b8013f6e21e06ea18cbd (diff) | |
download | gitea-75109bbd653f69e4a924b6654e564341e4bcf229.tar.gz gitea-75109bbd653f69e4a924b6654e564341e4bcf229.zip |
Fix panic when no master branch
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go index be889cba5f..35b3fde155 100644 --- a/models/repo.go +++ b/models/repo.go @@ -246,14 +246,17 @@ func CreateRepository(user *User, name, desc, lang, license string, private, mir } repo := &Repository{ - OwnerId: user.Id, - Name: name, - LowerName: strings.ToLower(name), - Description: desc, - IsPrivate: private, - IsBare: lang == "" && license == "" && !initReadme, - DefaultBranch: "master", + OwnerId: user.Id, + Name: name, + LowerName: strings.ToLower(name), + Description: desc, + IsPrivate: private, + IsBare: lang == "" && license == "" && !initReadme, } + if !repo.IsBare { + repo.DefaultBranch = "master" + } + repoPath := RepoPath(user.Name, repo.Name) sess := orm.NewSession() |