From 601c10309dd93c55c3c825c5a5c2384d46493589 Mon Sep 17 00:00:00 2001
From: Unknown <joe2010xtmf@163.com>
Date: Wed, 19 Mar 2014 13:24:46 -0400
Subject: [PATCH] Bug fix

---
 modules/base/conf.go        | 3 ++-
 routers/repo/single.go      | 1 +
 templates/repo/commits.tmpl | 2 +-
 web.go                      | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/base/conf.go b/modules/base/conf.go
index 41226459d9..b003dea50c 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -172,8 +172,9 @@ func init() {
 	AppUrl = Cfg.MustValue("server", "ROOT_URL")
 	Domain = Cfg.MustValue("server", "DOMAIN")
 	SecretKey = Cfg.MustValue("security", "SECRET_KEY")
+}
 
-	// Extensions.
+func NewServices() {
 	newService()
 	newLogService()
 	newMailService()
diff --git a/routers/repo/single.go b/routers/repo/single.go
index 285c5277af..1c9b35945d 100644
--- a/routers/repo/single.go
+++ b/routers/repo/single.go
@@ -188,6 +188,7 @@ func Commits(ctx *middleware.Context, params martini.Params) {
 	}
 	ctx.Data["Username"] = params["username"]
 	ctx.Data["Reponame"] = params["reponame"]
+	ctx.Data["CommitCount"] = commits.Len()
 	ctx.Data["Commits"] = commits
 	ctx.HTML(200, "repo/commits", ctx.Data)
 }
diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl
index 04ca19afc8..8b4e41f748 100644
--- a/templates/repo/commits.tmpl
+++ b/templates/repo/commits.tmpl
@@ -9,7 +9,7 @@
                 <div class="search pull-right form">
                     <input class="form-control search" type="search" placeholder="search commit"/>
                 </div>
-                <h4>Commits</h4>
+                <h4>{{.CommitCount}} Commits</h4>
             </div>
             <table class="panel-footer table commit-list table table-striped">
                 <thead>
diff --git a/web.go b/web.go
index 2cf3ba0932..2a9df17c8d 100644
--- a/web.go
+++ b/web.go
@@ -58,6 +58,7 @@ func newMartini() *martini.ClassicMartini {
 }
 
 func runWeb(*cli.Context) {
+	base.NewServices()
 	checkRunMode()
 	log.Info("%s %s", base.AppName, base.AppVer)