gitea/modules/repository
Lunny Xiao 32b97b3ce8
Uniform all temporary directories and allow customizing temp path (#32352)
This PR uniform all temporary directory usage so that it will be easier
to manage.

Relate to #31792 

- [x] Added a new setting to allow users to configure the global
temporary directory.
- [x] Move all temporary files and directories to be placed under
os.Temp()/gitea.
- [x] `setting.Repository.Local.LocalCopyPath` now will be
`setting.TempPath/local-repo` and the customized path is removed.
```diff
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;[repository.local]
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Path for local repository copy. Defaults to  TEMP_PATH + `local-repo`, this is deprecated and cannot be changed
-;LOCAL_COPY_PATH = local-repo
```

- [x] `setting.Repository.Upload.TempPath` now will be
`settting.TempPath/uploads` and the customized path is removed.
```diff
;[repository.upload]
-;;
-;; Path for uploads. Defaults to TEMP_PATH + `uploads`
-;TEMP_PATH = uploads
```

- [x] `setting.Packages.ChunkedUploadPath` now will be
`settting.TempPath/package-upload` and the customized path is removed.
```diff
;[packages]
-;;
-;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path.
-;CHUNKED_UPLOAD_PATH = package-upload
```

- [x] `setting.SSH.KeyTestPath` now will be
`settting.TempPath/ssh_key_test` and the customized path is removed.
```diff
[server]
-;;
-;; Directory to create temporary files in when testing public keys using ssh-keygen,
-;; default is the system temporary directory.
-;SSH_KEY_TEST_PATH =
```

TODO:
- [ ] setting.PprofDataPath haven't been changed because it may need to
be kept until somebody read it but temp path may be clean up any time.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-08 16:15:28 +00:00
..
branch_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
branch.go Trivial fixes (#33304) 2025-01-17 08:55:02 +00:00
commits_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
commits.go Refactor functions to reduce repopath expose (#33892) 2025-03-16 03:14:56 +00:00
create_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
create.go Use filepath.Join instead of path.Join for file system file operations (#33978) 2025-03-24 14:50:28 -07:00
delete.go Even more db.DefaultContext refactor (#27352) 2023-10-03 10:30:41 +00:00
env.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
fork_test.go Allow to fork repository into the same owner (#32819) 2024-12-14 09:39:05 +08:00
fork.go Fix various trivial problems (#32861) 2024-12-17 01:15:18 +00:00
init_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
init.go Rework create/fork/adopt/generate repository to make sure resources will be cleanup once failed (#31035) 2025-04-07 22:12:54 -07:00
license_test.go Fix repo avatar conflict (#32958) 2024-12-23 02:52:25 +00:00
license.go Support repo license (#24872) 2024-10-01 15:25:08 -04:00
main_test.go Move AddCollabrator and CreateRepositoryByExample to service layer (#32419) 2024-11-07 11:28:11 +08:00
push.go Improve ObjectFormat interface (#28496) 2023-12-19 07:20:47 +00:00
repo_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
repo.go Avoid creating unnecessary temporary cat file sub process (#33942) 2025-04-04 16:19:19 -07:00
temp.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +00:00