summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-13 16:01:57 -0400
committerUnknwon <u@gogs.io>2015-10-13 16:01:57 -0400
commit6a6e43f9649a04a3e421c1ca02f17af0556ca7fb (patch)
treea3f6b65b55e4c64a153b44501bb37da0c9ff5c7f
parenta42514613fa78685fad5191e56e14d0038e1ef6a (diff)
downloadgitea-6a6e43f9649a04a3e421c1ca02f17af0556ca7fb.tar.gz
gitea-6a6e43f9649a04a3e421c1ca02f17af0556ca7fb.zip
print out git version
-rw-r--r--models/repo.go1
-rw-r--r--modules/git/version.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go
index 75e1cd3a9b..7bda79fb2a 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -105,6 +105,7 @@ func NewRepoContext() {
if ver.LessThan(reqVer) {
log.Fatal(4, "Gogs requires Git version greater or equal to 1.7.1")
}
+ log.Info("Git version: %s", ver.String())
// Git requires setting user.name and user.email in order to commit changes.
for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogs@fake.local"} {
diff --git a/modules/git/version.go b/modules/git/version.go
index b535521ec4..9940518abb 100644
--- a/modules/git/version.go
+++ b/modules/git/version.go
@@ -6,6 +6,7 @@ package git
import (
"errors"
+ "fmt"
"strings"
"github.com/Unknwon/com"
@@ -78,6 +79,10 @@ func (v *Version) AtLeast(that *Version) bool {
return v.Compare(that) >= 0
}
+func (v *Version) String() string {
+ return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch)
+}
+
// GetVersion returns current Git version installed.
func GetVersion() (*Version, error) {
if gitVer != nil {