diff options
Diffstat (limited to 'modules/middleware')
-rw-r--r-- | modules/middleware/repo.go | 10 |
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 } |