gitea/services/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 +07:00
..
archiver Enable addtional linters (#34085) 2025-04-01 10:14:01 +07:00
commitstatus Add new event commit status creation and webhook implementation (#27151) 2024-11-07 06:41:49 +07:00
files Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +07:00
gitgraph Remove context from git struct (#33793) 2025-03-04 11:56:11 +07:00
adopt.go Check user/org repo limit instead of doer (#34147) 2025-04-07 23:45:31 +07:00
adopt_test.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
avatar.go Fix repo avatar conflict (#32958) 2024-12-23 02:52:25 +07:00
avatar_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 +07:00
branch.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +07:00
cache.go
check.go Remove context from git struct (#33793) 2025-03-04 11:56:11 +07:00
collaboration.go Move team related functions to service layer (#32537) 2024-11-27 21:12:26 +07:00
collaboration_test.go Move AddCollabrator and CreateRepositoryByExample to service layer (#32419) 2024-11-07 11:28:11 +07:00
commit.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +07:00
contributors_graph.go Remove context from git struct (#33793) 2025-03-04 11:56:11 +07:00
contributors_graph_test.go Enable testifylint rules (#34075) 2025-03-31 01:53:48 +07:00
create.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +07:00
create_test.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
delete.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
delete_test.go
fork.go Check user/org repo limit instead of doer (#34147) 2025-04-07 23:45:31 +07:00
fork_test.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
generate.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +07:00
generate_test.go Move generate from module to service (#29465) 2024-02-28 14:40:36 +07:00
hooks.go Don't create duplicated functions for code repositories and wiki repositories (#33924) 2025-03-19 11:17:19 +07:00
init.go Remove context from git struct (#33793) 2025-03-04 11:56:11 +07:00
lfs.go Use the database object format name but not read from git repoisitory everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294) 2024-02-24 06:55:19 +07:00
lfs_test.go Use test context in tests and new loop system in benchmarks (#33648) 2025-02-20 09:57:40 +07:00
license.go Only keep popular licenses (#33832) 2025-03-10 06:40:37 +07:00
license_test.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +07:00
main_test.go
merge_upstream.go Improve sync fork behavior (#33319) 2025-01-20 15:17:47 +07:00
migrate.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
push.go Avoid creating unnecessary temporary cat file sub process (#33942) 2025-04-04 16:19:19 +07:00
repo_team.go Move RepoTransfer from models to models/repo sub package (#32506) 2024-12-18 11:44:16 +07:00
repo_team_test.go Move team related functions to service layer (#32537) 2024-11-27 21:12:26 +07:00
repository.go Uniform all temporary directories and allow customizing temp path (#32352) 2025-04-08 16:15:28 +07:00
repository_test.go
setting.go Fix auto concurrency cancellation skips commit status updates (#33764) 2025-03-10 15:58:48 +07:00
template.go Check user/org repo limit instead of doer (#34147) 2025-04-07 23:45:31 +07:00
transfer.go Check user/org repo limit instead of doer (#34147) 2025-04-07 23:45:31 +07:00
transfer_test.go Check user/org repo limit instead of doer (#34147) 2025-04-07 23:45:31 +07:00