summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-10 22:03:31 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-10 22:03:31 -0400
commit306aa5bffe7868207ed7b773c1aedbf3f0a659ad (patch)
treea72a835c64833b31b2195585d018a03433917266 /modules
parent8980675a9f8f8328a81dde63174115c4a11f02a3 (diff)
downloadgitea-306aa5bffe7868207ed7b773c1aedbf3f0a659ad.tar.gz
gitea-306aa5bffe7868207ed7b773c1aedbf3f0a659ad.zip
Add support default branch
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/repo.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 2139742c70..ae9f04b113 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -76,7 +76,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Redirect("/")
return
}
- ctx.Handle(404, "RepoAssignment", err)
+ ctx.Handle(500, "RepoAssignment", err)
return
}
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
@@ -86,7 +86,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
gitRepo, err := git.OpenRepository(models.RepoPath(userName, repoName))
if err != nil {
- ctx.Handle(404, "RepoAssignment Invalid repo "+models.RepoPath(userName, repoName), err)
+ ctx.Handle(500, "RepoAssignment Invalid repo "+models.RepoPath(userName, repoName), err)
return
}
ctx.Repo.GitRepo = gitRepo
@@ -138,7 +138,10 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
}
} else {
- branchName = "master"
+ branchName = ctx.Repo.Repository.DefaultBranch
+ if len(branchName) == 0 {
+ branchName = "master"
+ }
goto detect
}
@@ -157,6 +160,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
}
ctx.Data["BranchName"] = ctx.Repo.BranchName
+ ctx.Data["Branches"], _ = models.GetBranches(ctx.User.Name, ctx.Repo.Repository.Name)
ctx.Data["CommitId"] = ctx.Repo.CommitId
ctx.Data["IsRepositoryWatching"] = ctx.Repo.IsWatching
}