mirror of
				https://gitcode.com/gitea/gitea.git
				synced 2025-10-26 21:43:41 +08:00 
			
		
		
		
	Store repository data in data path if not previously set (#13991)
* Store repository data in data path if not previously set * update docs * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: silverwind <me@silverwind.io> * update docs Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		| @ -17,7 +17,9 @@ PROJECT_BOARD_BASIC_KANBAN_TYPE = To Do, In Progress, Done | |||||||
| PROJECT_BOARD_BUG_TRIAGE_TYPE = Needs Triage, High Priority, Low Priority, Closed | PROJECT_BOARD_BUG_TRIAGE_TYPE = Needs Triage, High Priority, Low Priority, Closed | ||||||
|  |  | ||||||
| [repository] | [repository] | ||||||
|  | ; Root path for storing all repository data. It must be an absolute path. By default it is stored in a sub-directory of `APP_DATA_PATH`. | ||||||
| ROOT = | ROOT = | ||||||
|  | ; The script type this server supports. Usually this is `bash`, but some users report that only `sh` is available. | ||||||
| SCRIPT_TYPE = bash | SCRIPT_TYPE = bash | ||||||
| ; DETECTED_CHARSETS_ORDER tie-break order for detected charsets. | ; DETECTED_CHARSETS_ORDER tie-break order for detected charsets. | ||||||
| ; If the charsets have equal confidence, tie-breaking will be done by order in this list | ; If the charsets have equal confidence, tie-breaking will be done by order in this list | ||||||
|  | |||||||
| @ -42,8 +42,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. | |||||||
|  |  | ||||||
| ## Repository (`repository`) | ## Repository (`repository`) | ||||||
|  |  | ||||||
| - `ROOT`: **~/gitea-repositories/**: Root path for storing all repository data. It must be | - `ROOT`: **data/gitea-repositories/**: Root path for storing all repository data. It must be | ||||||
|    an absolute path. |    an absolute path. By default it is stored in a sub-directory of `APP_DATA_PATH`. | ||||||
| - `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`, | - `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`, | ||||||
|    but some users report that only `sh` is available. |    but some users report that only `sh` is available. | ||||||
| - `DETECTED_CHARSETS_ORDER`: **UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr**: Tie-break order of detected charsets - if the detected charsets have equal confidence, charsets earlier in the list will be chosen in preference to those later. Adding `defaults` will place the unnamed charsets at that point. | - `DETECTED_CHARSETS_ORDER`: **UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr**: Tie-break order of detected charsets - if the detected charsets have equal confidence, charsets earlier in the list will be chosen in preference to those later. Adding `defaults` will place the unnamed charsets at that point. | ||||||
|  | |||||||
| @ -64,7 +64,7 @@ https://github.com/loganinak/MigrateGitlabToGogs | |||||||
|   - Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH` |   - Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH` | ||||||
| - RepoRootPath | - RepoRootPath | ||||||
|   - `ROOT` in `app.ini` |   - `ROOT` in `app.ini` | ||||||
|   - Else `%(HomeDir)/gitea-repositories` |   - Else `%(AppDataPath)/gitea-repositories` | ||||||
| - INI (config file) | - INI (config file) | ||||||
|   - `-c` flag |   - `-c` flag | ||||||
|   - Else `%(CustomPath)/conf/app.ini` |   - Else `%(CustomPath)/conf/app.ini` | ||||||
|  | |||||||
| @ -10,8 +10,6 @@ import ( | |||||||
| 	"strings" | 	"strings" | ||||||
|  |  | ||||||
| 	"code.gitea.io/gitea/modules/log" | 	"code.gitea.io/gitea/modules/log" | ||||||
|  |  | ||||||
| 	"github.com/unknwon/com" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // enumerates all the policy repository creating | // enumerates all the policy repository creating | ||||||
| @ -249,19 +247,14 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func newRepository() { | func newRepository() { | ||||||
| 	homeDir, err := com.HomeDir() | 	var err error | ||||||
| 	if err != nil { |  | ||||||
| 		log.Fatal("Failed to get home directory: %v", err) |  | ||||||
| 	} |  | ||||||
| 	homeDir = strings.ReplaceAll(homeDir, "\\", "/") |  | ||||||
|  |  | ||||||
| 	// Determine and create root git repository path. | 	// Determine and create root git repository path. | ||||||
| 	sec := Cfg.Section("repository") | 	sec := Cfg.Section("repository") | ||||||
| 	Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool() | 	Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool() | ||||||
| 	Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool() | 	Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool() | ||||||
| 	Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1) | 	Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1) | ||||||
| 	Repository.DefaultBranch = sec.Key("DEFAULT_BRANCH").MustString(Repository.DefaultBranch) | 	Repository.DefaultBranch = sec.Key("DEFAULT_BRANCH").MustString(Repository.DefaultBranch) | ||||||
| 	RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gitea-repositories")) | 	RepoRootPath = sec.Key("ROOT").MustString(path.Join(AppDataPath, "gitea-repositories")) | ||||||
| 	forcePathSeparator(RepoRootPath) | 	forcePathSeparator(RepoRootPath) | ||||||
| 	if !filepath.IsAbs(RepoRootPath) { | 	if !filepath.IsAbs(RepoRootPath) { | ||||||
| 		RepoRootPath = filepath.Join(AppWorkPath, RepoRootPath) | 		RepoRootPath = filepath.Join(AppWorkPath, RepoRootPath) | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ architectures: | |||||||
|  |  | ||||||
| environment: | environment: | ||||||
|   GITEA_CUSTOM: "$SNAP_COMMON" |   GITEA_CUSTOM: "$SNAP_COMMON" | ||||||
|   GITEA_WORK_DIR: "$SNAP_DATA" |   GITEA_WORK_DIR: "$SNAP_COMMON" | ||||||
|   GIT_TEMPLATE_DIR: "$SNAP/usr/share/git-core/templates" |   GIT_TEMPLATE_DIR: "$SNAP/usr/share/git-core/templates" | ||||||
|   GIT_EXEC_PATH: "$SNAP/usr/lib/git-core" |   GIT_EXEC_PATH: "$SNAP/usr/lib/git-core" | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 techknowlogick
					techknowlogick