File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
"fmt"
12
12
"os"
13
13
"os/exec"
14
+ "path/filepath"
14
15
"regexp"
15
16
"runtime"
16
17
"strings"
@@ -180,6 +181,24 @@ func InitOnceWithSync(ctx context.Context) (err error) {
180
181
return
181
182
}
182
183
184
+ // Gitea 1.17-rc uses "setting.RepoRootPath" for Git HOME, which is incorrect.
185
+ // Do this check to make sure there is no legacy file in the RepoRootPath. This check might be able to be removed with 1.19 release.
186
+ var hasCheckErr bool
187
+ _ = os .Remove (filepath .Join (setting .RepoRootPath , ".gitconfig" )) // remove the auto generated git config file
188
+ _ = os .Remove (filepath .Join (setting .RepoRootPath , ".ssh" )) // remove the empty dummy ".ssh" directory
189
+ for _ , wellKnownName := range []string {".ssh" , ".gnupg" } {
190
+ checkLegacyFile := filepath .Join (setting .RepoRootPath , wellKnownName )
191
+ _ , checkErr := os .Stat (checkLegacyFile )
192
+ if checkErr == nil || ! errors .Is (checkErr , os .ErrNotExist ) {
193
+ log .Error (`Git HOME has been moved to [git].HOME_PATH, but there are legacy file in old place. Please backup and remove the legacy files %q` , checkLegacyFile )
194
+ hasCheckErr = true
195
+ }
196
+ }
197
+ if hasCheckErr {
198
+ log .Fatal ("Please fix errors above, remove legacy files" )
199
+ }
200
+ // end of legacy Gitea 1.17-rc check
201
+
183
202
// Since git wire protocol has been released from git v2.18
184
203
if setting .Git .EnableAutoGitWireProtocol && CheckGitVersionAtLeast ("2.18" ) == nil {
185
204
globalCommandArgs = append (globalCommandArgs , "-c" , "protocol.version=2" )
You can’t perform that action at this time.
0 commit comments