@@ -20,8 +20,6 @@ import (
20
20
21
21
"code.gitea.io/gitea/modules/log"
22
22
"code.gitea.io/gitea/modules/setting"
23
- "code.gitea.io/gitea/modules/util"
24
-
25
23
"github.com/hashicorp/go-version"
26
24
)
27
25
@@ -168,51 +166,6 @@ func InitSimple(ctx context.Context) error {
168
166
169
167
var initOnce sync.Once
170
168
171
- func initFixGitHome117rc () error {
172
- // Gitea 1.17-rc uses "setting.RepoRootPath" for Git HOME, which is incorrect.
173
- // Do this check to make sure there is no legacy file in the RepoRootPath. This check might be able to be removed with 1.18 release.
174
-
175
- // remove the auto generated git config file (it will be moved to new home)
176
- gitConfigNewPath := filepath .Join (HomeDir (), ".gitconfig" )
177
- gitConfigLegacyPath := filepath .Join (setting .RepoRootPath , ".gitconfig" )
178
- if ok , err := util .IsExist (gitConfigLegacyPath ); ok && err == nil {
179
- if err = os .MkdirAll (HomeDir (), os .ModePerm ); err != nil {
180
- return err
181
- }
182
- if ok , err = util .IsExist (gitConfigNewPath ); ! ok && err == nil {
183
- err = util .CopyFile (gitConfigLegacyPath , gitConfigNewPath )
184
- } else {
185
- err = util .CopyFile (gitConfigLegacyPath , gitConfigNewPath + ".bak" )
186
- }
187
- if err != nil {
188
- return err
189
- }
190
- _ = os .Remove (gitConfigLegacyPath )
191
- }
192
-
193
- // remove the empty directories, if some directories are non-empty, warn users and exit
194
- var hasCheckErr bool
195
- for _ , wellKnownDirName := range []string {".ssh" , ".gnupg" } {
196
- legacyDir := filepath .Join (setting .RepoRootPath , wellKnownDirName )
197
- st , err := os .Lstat (legacyDir ) // only process dir or symlink
198
- if err != nil || (! st .IsDir () && st .Mode ()& os .ModeSymlink != os .ModeSymlink ) {
199
- continue
200
- }
201
- _ = os .Remove (legacyDir ) // try to remove the empty dummy directory first
202
- _ , err = os .Stat (legacyDir ) // if the directory is not empty, then it won't be removed, it should be handled manually
203
- if err == nil || ! errors .Is (err , os .ErrNotExist ) {
204
- 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` , legacyDir )
205
- hasCheckErr = true
206
- }
207
- }
208
-
209
- if hasCheckErr {
210
- log .Fatal ("Please fix errors above, remove legacy files." )
211
- }
212
-
213
- return nil
214
- }
215
-
216
169
// InitOnceWithSync initializes git module with version check and change global variables, sync gitconfig.
217
170
// This method will update the global variables ONLY ONCE (just like git.CheckLFSVersion -- which is not ideal too),
218
171
// otherwise there will be data-race problem at the moment.
@@ -225,9 +178,6 @@ func InitOnceWithSync(ctx context.Context) (err error) {
225
178
if err = InitSimple (ctx ); err != nil {
226
179
return
227
180
}
228
- if err = initFixGitHome117rc (); err != nil {
229
- return
230
- }
231
181
232
182
// when git works with gnupg (commit signing), there should be a stable home for gnupg commands
233
183
if _ , ok := os .LookupEnv ("GNUPGHOME" ); ! ok {
0 commit comments