aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/git_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-06-20 00:53:37 +0800
committerLauris BH <lauris@nix.lv>2019-06-19 19:53:37 +0300
commit8ec659722df32048561c713f2d533a20a7f0d5ef (patch)
tree65294eb54428215b23401081c657881680168ed1 /modules/git/git_test.go
parenta71cabbd537d2ca3f937e8fb986315ccc6701270 (diff)
downloadgitea-8ec659722df32048561c713f2d533a20a7f0d5ef.tar.gz
gitea-8ec659722df32048561c713f2d533a20a7f0d5ef.zip
Only check and config git on web subcommand but not others (#7236)
* only check and config git on web subcommand but not others * add Init in git tests
Diffstat (limited to 'modules/git/git_test.go')
-rw-r--r--modules/git/git_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/git/git_test.go b/modules/git/git_test.go
new file mode 100644
index 0000000000..0c6259a9c5
--- /dev/null
+++ b/modules/git/git_test.go
@@ -0,0 +1,25 @@
+// Copyright 2019 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "fmt"
+ "os"
+ "testing"
+)
+
+func fatalTestError(fmtStr string, args ...interface{}) {
+ fmt.Fprintf(os.Stderr, fmtStr, args...)
+ os.Exit(1)
+}
+
+func TestMain(m *testing.M) {
+ if err := Init(); err != nil {
+ fatalTestError("Init failed: %v", err)
+ }
+
+ exitStatus := m.Run()
+ os.Exit(exitStatus)
+}