@@ -126,8 +126,8 @@ func VersionInfo() string {
126
126
}
127
127
128
128
func checkInit () error {
129
- if setting .RepoRootPath == "" {
130
- return errors .New ("can not init Git's HomeDir (RepoRootPath is empty) , the setting and git modules are not initialized correctly" )
129
+ if setting .Git . HomePath == "" {
130
+ return errors .New ("can not init Git's HomeDir, the setting and git modules are not initialized correctly" )
131
131
}
132
132
if DefaultContext != nil {
133
133
log .Warn ("git module has been initialized already, duplicate init should be fixed" )
@@ -137,14 +137,14 @@ func checkInit() error {
137
137
138
138
// HomeDir is the home dir for git to store the global config file used by Gitea internally
139
139
func HomeDir () string {
140
- if setting .RepoRootPath == "" {
140
+ if setting .Git . HomePath == "" {
141
141
// strict check, make sure the git module is initialized correctly.
142
142
// attention: when the git module is called in gitea sub-command (serv/hook), the log module is not able to show messages to users.
143
143
// for example: if there is gitea git hook code calling git.NewCommand before git.InitXxx, the integration test won't show the real failure reasons.
144
- log .Fatal ("can not get Git's HomeDir (RepoRootPath is empty) , the setting and git modules are not initialized correctly" )
144
+ log .Fatal ("can not get Git's HomeDir, the setting and git modules are not initialized correctly" )
145
145
return ""
146
146
}
147
- return setting .RepoRootPath
147
+ return setting .Git . HomePath
148
148
}
149
149
150
150
// InitSimple initializes git module with a very simple step, no config changes, no global command arguments.
@@ -206,7 +206,7 @@ func InitOnceWithSync(ctx context.Context) (err error) {
206
206
// syncGitConfig only modifies gitconfig, won't change global variables (otherwise there will be data-race problem)
207
207
func syncGitConfig () (err error ) {
208
208
if err = os .MkdirAll (HomeDir (), os .ModePerm ); err != nil {
209
- return fmt .Errorf ("unable to create directory %s, err: %w" , setting . RepoRootPath , err )
209
+ return fmt .Errorf ("unable to prepare git home directory %s, err: %w" , HomeDir () , err )
210
210
}
211
211
212
212
// Git requires setting user.name and user.email in order to commit changes - old comment: "if they're not set just add some defaults"
0 commit comments