![Demo](http://gowalker.org/public/gogs_demo.gif)
-##### Current version: 0.3.1 Alpha
+##### Current version: 0.3.2 Alpha
### NOTICES
![Demo](http://gowalker.org/public/gogs_demo.gif)
-##### 当前版本:0.3.1 Alpha
+##### 当前版本:0.3.2 Alpha
## 开发目的
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true
-const APP_VER = "0.3.1.0501 Alpha"
+const APP_VER = "0.3.2.0501 Alpha"
func init() {
base.AppVer = APP_VER
}
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()
}
} else {
- refName = ctx.Repo.Repository.DefaultBranch
if len(refName) == 0 {
- refName = "master"
+ if gitRepo.IsBranchExist(ctx.Repo.Repository.DefaultBranch) {
+ refName = ctx.Repo.Repository.DefaultBranch
+ } else {
+ brs, err := gitRepo.GetBranches()
+ if err != nil {
+ ctx.Handle(500, "RepoAssignment(GetBranches))", err)
+ return
+ }
+ refName = brs[0]
+ }
}
goto detect
}
<label class="col-md-3 text-right">Default Branch</label>
<div class="col-md-3">
<select name="branch" id="repo-default-branch" class="form-control">
- <option value="{{.Repository.DefaultBranch}}">{{.Repository.DefaultBranch}}</option>
+ {{if .Repository.DefaultBranch}}<option value="{{.Repository.DefaultBranch}}">{{.Repository.DefaultBranch}}</option>{{end}}
{{range .Branches}}
{{if eq . $.Repository.DefaultBranch}}{{else}}<option value="{{.}}">{{.}}</option>{{end}}
{{end}}