Need a field to specify if repository is bare
This commit is contained in:
parent
cd070b56d2
commit
e3f55ca0fb
3 changed files with 7 additions and 10 deletions
|
@ -87,6 +87,7 @@ func CommitRepoAction(userId int64, userName string,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
repo.IsBare = false
|
||||||
repo.Updated = time.Now()
|
repo.Updated = time.Now()
|
||||||
if err = UpdateRepository(repo); err != nil {
|
if err = UpdateRepository(repo); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -83,10 +83,11 @@ type Repository struct {
|
||||||
Name string `xorm:"index not null"`
|
Name string `xorm:"index not null"`
|
||||||
Description string
|
Description string
|
||||||
Website string
|
Website string
|
||||||
Private bool
|
|
||||||
NumWatches int
|
NumWatches int
|
||||||
NumStars int
|
NumStars int
|
||||||
NumForks int
|
NumForks int
|
||||||
|
IsPrivate bool
|
||||||
|
IsBare bool
|
||||||
Created time.Time `xorm:"created"`
|
Created time.Time `xorm:"created"`
|
||||||
Updated time.Time `xorm:"updated"`
|
Updated time.Time `xorm:"updated"`
|
||||||
}
|
}
|
||||||
|
@ -139,7 +140,8 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
|
||||||
Name: repoName,
|
Name: repoName,
|
||||||
LowerName: strings.ToLower(repoName),
|
LowerName: strings.ToLower(repoName),
|
||||||
Description: desc,
|
Description: desc,
|
||||||
Private: private,
|
IsPrivate: private,
|
||||||
|
IsBare: repoLang == "" && license == "" && !initReadme,
|
||||||
}
|
}
|
||||||
|
|
||||||
repoPath := RepoPath(user.Name, repoName)
|
repoPath := RepoPath(user.Name, repoName)
|
||||||
|
|
|
@ -69,7 +69,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
log.Error("repo.Single(GetBranches): %v", err)
|
log.Error("repo.Single(GetBranches): %v", err)
|
||||||
ctx.Error(404)
|
ctx.Error(404)
|
||||||
return
|
return
|
||||||
} else if len(brs) == 0 {
|
} else if ctx.Repo.Repository.IsBare {
|
||||||
ctx.Data["IsBareRepo"] = true
|
ctx.Data["IsBareRepo"] = true
|
||||||
ctx.HTML(200, "repo/single")
|
ctx.HTML(200, "repo/single")
|
||||||
return
|
return
|
||||||
|
@ -224,13 +224,7 @@ func Setting(ctx *middleware.Context, params martini.Params) {
|
||||||
|
|
||||||
ctx.Data["IsRepoToolbarSetting"] = true
|
ctx.Data["IsRepoToolbarSetting"] = true
|
||||||
|
|
||||||
// Branches.
|
if ctx.Repo.Repository.IsBare {
|
||||||
brs, err := models.GetBranches(params["username"], params["reponame"])
|
|
||||||
if err != nil {
|
|
||||||
log.Error("repo.Setting(GetBranches): %v", err)
|
|
||||||
ctx.Error(404)
|
|
||||||
return
|
|
||||||
} else if len(brs) == 0 {
|
|
||||||
ctx.Data["IsBareRepo"] = true
|
ctx.Data["IsBareRepo"] = true
|
||||||
ctx.HTML(200, "repo/setting")
|
ctx.HTML(200, "repo/setting")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue