Fix panic when no master branch
This commit is contained in:
parent
0a187dbef5
commit
75109bbd65
6 changed files with 24 additions and 13 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue