@@ -13,7 +13,6 @@ import (
13
13
"io/ioutil"
14
14
"net/url"
15
15
"os"
16
- "os/exec"
17
16
"path"
18
17
"path/filepath"
19
18
"regexp"
@@ -32,11 +31,9 @@ import (
32
31
"code.gitea.io/gitea/modules/sync"
33
32
"code.gitea.io/gitea/modules/util"
34
33
35
- "github.com/Unknwon/cae/zip"
36
34
"github.com/Unknwon/com"
37
35
"github.com/go-xorm/builder"
38
36
"github.com/go-xorm/xorm"
39
- version "github.com/mcuadros/go-version"
40
37
ini "gopkg.in/ini.v1"
41
38
)
42
39
67
64
ItemsPerPage = 40
68
65
)
69
66
70
- // LoadRepoConfig loads the repository config
71
- func LoadRepoConfig () {
67
+ // loadRepoConfig loads the repository config
68
+ func loadRepoConfig () {
72
69
// Load .gitignore and license files and readme templates.
73
70
types := []string {"gitignore" , "license" , "readme" , "label" }
74
71
typeFiles := make ([][]string , 4 )
@@ -119,45 +116,7 @@ func LoadRepoConfig() {
119
116
120
117
// NewRepoContext creates a new repository context
121
118
func NewRepoContext () {
122
- zip .Verbose = false
123
-
124
- // Check Git installation.
125
- if _ , err := exec .LookPath ("git" ); err != nil {
126
- log .Fatal ("Failed to test 'git' command: %v (forgotten install?)" , err )
127
- }
128
-
129
- // Check Git version.
130
- var err error
131
- setting .Git .Version , err = git .BinVersion ()
132
- if err != nil {
133
- log .Fatal ("Failed to get Git version: %v" , err )
134
- }
135
-
136
- log .Info ("Git Version: %s" , setting .Git .Version )
137
- if version .Compare ("1.7.1" , setting .Git .Version , ">" ) {
138
- log .Fatal ("Gitea requires Git version greater or equal to 1.7.1" )
139
- }
140
-
141
- // Git requires setting user.name and user.email in order to commit changes.
142
- for configKey ,
defaultValue := range map [
string ]
string {
"user.name" :
"Gitea" ,
"user.email" :
"[email protected] " } {
143
- if stdout , stderr , err := process .GetManager ().Exec ("NewRepoContext(get setting)" , "git" , "config" , "--get" , configKey ); err != nil || strings .TrimSpace (stdout ) == "" {
144
- // ExitError indicates this config is not set
145
- if _ , ok := err .(* exec.ExitError ); ok || strings .TrimSpace (stdout ) == "" {
146
- if _ , stderr , gerr := process .GetManager ().Exec ("NewRepoContext(set " + configKey + ")" , "git" , "config" , "--global" , configKey , defaultValue ); gerr != nil {
147
- log .Fatal ("Failed to set git %s(%s): %s" , configKey , gerr , stderr )
148
- }
149
- log .Info ("Git config %s set to %s" , configKey , defaultValue )
150
- } else {
151
- log .Fatal ("Failed to get git %s(%s): %s" , configKey , err , stderr )
152
- }
153
- }
154
- }
155
-
156
- // Set git some configurations.
157
- if _ , stderr , err := process .GetManager ().Exec ("NewRepoContext(git config --global core.quotepath false)" ,
158
- "git" , "config" , "--global" , "core.quotepath" , "false" ); err != nil {
159
- log .Fatal ("Failed to execute 'git config --global core.quotepath false': %s" , stderr )
160
- }
119
+ loadRepoConfig ()
161
120
162
121
RemoveAllWithNotice ("Clean up repository temporary data" , filepath .Join (setting .AppDataPath , "tmp" ))
163
122
}
0 commit comments