summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/action.go1
-rw-r--r--models/repo.go6
-rw-r--r--routers/repo/single.go10
3 files changed, 7 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go
index 12122ae240..4e1107f891 100644
--- a/models/action.go
+++ b/models/action.go
@@ -87,6 +87,7 @@ func CommitRepoAction(userId int64, userName string,
if err != nil {
return err
}
+ repo.IsBare = false
repo.Updated = time.Now()
if err = UpdateRepository(repo); err != nil {
return err
diff --git a/models/repo.go b/models/repo.go
index 1961b31e94..fb115de590 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -83,10 +83,11 @@ type Repository struct {
Name string `xorm:"index not null"`
Description string
Website string
- Private bool
NumWatches int
NumStars int
NumForks int
+ IsPrivate bool
+ IsBare bool
Created time.Time `xorm:"created"`
Updated time.Time `xorm:"updated"`
}
@@ -139,7 +140,8 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
Name: repoName,
LowerName: strings.ToLower(repoName),
Description: desc,
- Private: private,
+ IsPrivate: private,
+ IsBare: repoLang == "" && license == "" && !initReadme,
}
repoPath := RepoPath(user.Name, repoName)
diff --git a/routers/repo/single.go b/routers/repo/single.go
index 37c0fabd79..5906e64fb9 100644
--- a/routers/repo/single.go
+++ b/routers/repo/single.go
@@ -69,7 +69,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
log.Error("repo.Single(GetBranches): %v", err)
ctx.Error(404)
return
- } else if len(brs) == 0 {
+ } else if ctx.Repo.Repository.IsBare {
ctx.Data["IsBareRepo"] = true
ctx.HTML(200, "repo/single")
return
@@ -224,13 +224,7 @@ func Setting(ctx *middleware.Context, params martini.Params) {
ctx.Data["IsRepoToolbarSetting"] = true
- // Branches.
- 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 {
+ if ctx.Repo.Repository.IsBare {
ctx.Data["IsBareRepo"] = true
ctx.HTML(200, "repo/setting")
return