Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Fix spelling mistake in ProcReceive (go-gitea#19853)
  Ensure responses are context.ResponseWriters (go-gitea#19843)
  Fix inconsistency in doctor output (go-gitea#19836)
  docs: recommendations to ensure backup consistency and reliability (go-gitea#19845)
  feat: Add support for extra sshd_config parameters via 'Include' file (go-gitea#19842)
  [skip ci] Updated translations via Crowdin
  docs: update the ROOT documentation and error messages (go-gitea#19832)
  • Loading branch information
zjjhot committed Jun 1, 2022
2 parents e6177c2 + d002e3d commit b16c312
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/serv.go
Expand Up @@ -302,7 +302,7 @@ func runServ(c *cli.Context) error {
if _, err := os.Stat(setting.RepoRootPath); err != nil {
if os.IsNotExist(err) {
return fail("Incorrect configuration.",
"Directory `[repository]` `ROOT` was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository]` `ROOT` an absolute value.")
"Directory `[repository]` `ROOT` %s was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository]` `ROOT` an absolute value.", setting.RepoRootPath)
}
}

Expand Down
3 changes: 2 additions & 1 deletion custom/conf/app.example.ini
Expand Up @@ -813,7 +813,8 @@ PATH =
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;[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 path for storing all repository data. By default, it is set to %(APP_DATA_PATH)/gitea-repositories.
;; A relative path is interpreted as %(GITEA_WORK_DIR)/%(ROOT)
;ROOT =
;;
;; The script type this server supports. Usually this is `bash`, but some users report that only `sh` is available.
Expand Down
1 change: 1 addition & 0 deletions docker/root/etc/s6/openssh/setup
Expand Up @@ -49,6 +49,7 @@ if [ -d /etc/ssh ]; then
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
SSH_INCLUDE_FILE="${SSH_INCLUDE_FILE:+"Include "}${SSH_INCLUDE_FILE}" \
SSH_LOG_LEVEL=${SSH_LOG_LEVEL:-"INFO"} \
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config

Expand Down
2 changes: 2 additions & 0 deletions docker/root/etc/templates/sshd_config
Expand Up @@ -41,3 +41,5 @@ Banner none
Subsystem sftp /usr/lib/ssh/sftp-server

AcceptEnv GIT_PROTOCOL

${SSH_INCLUDE_FILE}
4 changes: 2 additions & 2 deletions docs/content/doc/advanced/config-cheat-sheet.en-us.md
Expand Up @@ -42,8 +42,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.

## Repository (`repository`)

- `ROOT`: **data/gitea-repositories/**: 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`: **%(APP_DATA_PATH)/gitea-repositories**: Root path for storing all repository data.
A relative path is interpreted as **%(GITEA_WORK_DIR)/%(ROOT)**.
- `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`,
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.
Expand Down
5 changes: 3 additions & 2 deletions docs/content/doc/help/faq.en-us.md
Expand Up @@ -64,8 +64,9 @@ https://github.com/loganinak/MigrateGitlabToGogs
- Unix: Environment variable `HOME`
- Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH`
- RepoRootPath
- `ROOT` in `app.ini`
- Else `%(AppDataPath)/gitea-repositories`
- `ROOT` in the \[repository] section of `app.ini` if absolute
- Else `%(AppWorkPath)/ROOT` if `ROOT` in the \[repository] section of `app.ini` if relative
- Default `%(AppDataPath)/gitea-repositories`
- INI (config file)
- `-c` flag
- Else `%(CustomPath)/conf/app.ini`
Expand Down
17 changes: 17 additions & 0 deletions docs/content/doc/usage/backup-and-restore.en-us.md
Expand Up @@ -22,6 +22,12 @@ file can be unpacked and used to restore an instance.

{{< toc >}}

## Backup Consistency

To ensure the consistency of the Gitea instance, it must be shutdown during backup.

Gitea consists of a database, files and git repositories, all of which change when it is used. For instance, when a migration is in progress, a transaction is created in the database while the git repository is being copied over. If the backup happens in the middle of the migration, the git repository may be incomplete although the database claims otherwise because it was dumped afterwards. The only way to avoid such race conditions is by stopping the Gitea instance during the backups.

## Backup Command (`dump`)

Switch to the user running Gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the Gitea installation
Expand All @@ -48,6 +54,17 @@ Inside the `gitea-dump-1482906742.zip` file, will be the following:
Intermediate backup files are created in a temporary directory specified either with the
`--tempdir` command-line parameter or the `TMPDIR` environment variable.

## Backup the database

The SQL dump created by `gitea dump` uses XORM and Gitea admins may prefer to use the native the MySQL and PostgreSQL dump tools instead. There are still open issues when using XORM for dumping the database that may cause problems when attempting to restore it.

```sh
# mysql
mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
# postgres
pgdump -U $USER $DATABASE > gitea-db.sql
```

### Using Docker (`dump`)

There are a few caveats for using the `dump` command with Docker.
Expand Down
6 changes: 5 additions & 1 deletion modules/doctor/fix16961.go
Expand Up @@ -302,7 +302,11 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo
}

if !autofix {
logger.Warn("Found %d broken repo_units", count)
if count == 0 {
logger.Info("Found no broken repo_units")
} else {
logger.Warn("Found %d broken repo_units", count)
}
return nil
}
logger.Info("Fixed %d broken repo_units", count)
Expand Down
8 changes: 5 additions & 3 deletions modules/doctor/mergebase.go
Expand Up @@ -92,12 +92,14 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro
if autofix {
logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} else {
if numPRsUpdated > 0 && err == nil {
if numPRsUpdated == 0 {
logger.Info("All %d PRs in %d repos have a correct mergebase", numPRs, numRepos)
} else if err == nil {
logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} else {
logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
}

logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
}

return err
Expand Down
6 changes: 6 additions & 0 deletions modules/web/wrap_convert.go
Expand Up @@ -21,6 +21,9 @@ func convertHandler(handler interface{}) wrappedHandlerFunc {
case http.HandlerFunc:
return func(resp http.ResponseWriter, req *http.Request, others ...wrappedHandlerFunc) (done bool, deferrable func()) {
routing.UpdateFuncInfo(req.Context(), funcInfo)
if _, ok := resp.(context.ResponseWriter); !ok {
resp = context.NewResponse(resp)
}
t(resp, req)
if r, ok := resp.(context.ResponseWriter); ok && r.Status() > 0 {
done = true
Expand Down Expand Up @@ -92,6 +95,9 @@ func convertHandler(handler interface{}) wrappedHandlerFunc {
next = wrapInternal(others)
}
routing.UpdateFuncInfo(req.Context(), funcInfo)
if _, ok := resp.(context.ResponseWriter); !ok {
resp = context.NewResponse(resp)
}
t(next).ServeHTTP(resp, req)
if r, ok := resp.(context.ResponseWriter); ok && r.Status() > 0 {
done = true
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_el-GR.ini
Expand Up @@ -778,6 +778,7 @@ webauthn_delete_key_desc=Αν αφαιρέσετε ένα κλειδί ασφα
manage_account_links=Διαχείριση Συνδεδεμένων Λογαριασμών
manage_account_links_desc=Αυτοί οι εξωτερικοί λογαριασμοί είναι συνδεδεμένοι στον Gitea λογαριασμό σας.
account_links_not_available=Προς το παρόν δεν υπάρχουν εξωτερικοί λογαριασμοί συνδεδεμένοι με τον λογαριασμό σας στο Gitea.
link_account=Σύνδεση Λογαριασμού
remove_account_link=Αφαίρεση Συνδεδεμένου Λογαριασμού
remove_account_link_desc=Η κατάργηση ενός συνδεδεμένου λογαριασμού θα ανακαλέσει την πρόσβασή του στο λογαριασμό σας στο Gitea. Συνέχεια;
remove_account_link_success=Ο συνδεδεμένος λογαριασμός έχει αφαιρεθεί.
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_ja-JP.ini
Expand Up @@ -778,6 +778,7 @@ webauthn_delete_key_desc=セキュリティキーの登録を解除すると、
manage_account_links=連携アカウントの管理
manage_account_links_desc=これらの外部アカウントがGiteaアカウントと連携されています。
account_links_not_available=現在このGiteaアカウントが連携している外部アカウントはありません。
link_account=アカウントをリンク
remove_account_link=連携アカウントの削除
remove_account_link_desc=連携アカウントを削除し、Giteaアカウントへのアクセス権を取り消します。 続行しますか?
remove_account_link_success=連携アカウントを削除しました。
Expand Down Expand Up @@ -2423,6 +2424,7 @@ dashboard.new_version_hint=Gitea %s が入手可能になりました。 現在
dashboard.statistic=サマリー
dashboard.operations=メンテナンス操作
dashboard.system_status=システム状況
dashboard.statistic_info=Giteaデータベースは <b>%d</b> ユーザー, <b>%d</b> 組織, <b>%d</b> 公開鍵, <b>%d</b> リポジトリ, <b>%d</b> ウォッチ, <b>%d</b> スター, ~<b>%d</b> アクション, <b>%d</b> アクセス, <b>%d</b> イシュー, <b>%d</b> コメント, <b>%d</b> ソーシャルアカウント, <b>%d</b> フォロー, <b>%d</b> ミラー, <b>%d</b> リリース, <b>%d</b> 認証ソース, <b>%d</b> Webhook, <b>%d</b> マイルストーン, <b>%d</b> ラベル, <b>%d</b> フックタスク, <b>%d</b> チーム, <b>%d</b> 更新タスク, <b>%d</b> 添付ファイル の情報を持っています。
dashboard.operation_name=操作の名称
dashboard.operation_switch=切り替え
dashboard.operation_run=実行
Expand Down
3 changes: 2 additions & 1 deletion options/locale/locale_zh-CN.ini
Expand Up @@ -6,7 +6,7 @@ sign_in=登录
sign_in_with=登录方式
sign_out=退出
sign_up=注册
link_account=链接帐户
link_account=链接账户
register=注册
website=官方网站
version=当前版本
Expand Down Expand Up @@ -778,6 +778,7 @@ webauthn_delete_key_desc=如果删除了安全密钥,则不能再使用它登
manage_account_links=管理绑定过的账号
manage_account_links_desc=这些外部帐户已经绑定到您的 Gitea 帐户。
account_links_not_available=当前没有与您的 Gitea 帐户绑定的外部帐户。
link_account=链接账户
remove_account_link=删除已绑定的账号
remove_account_link_desc=删除已绑定帐户将吊销其对您的 Gitea 帐户的访问权限。继续?
remove_account_link_success=已取消绑定帐户。
Expand Down
2 changes: 1 addition & 1 deletion routers/private/hook_proc_receive.go
Expand Up @@ -23,7 +23,7 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
return
}

results := agit.ProcRecive(ctx, opts)
results := agit.ProcReceive(ctx, opts)
if ctx.Written() {
return
}
Expand Down
4 changes: 2 additions & 2 deletions services/agit/agit.go
Expand Up @@ -20,8 +20,8 @@ import (
pull_service "code.gitea.io/gitea/services/pull"
)

// ProcRecive handle proc receive work
func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HookProcReceiveRefResult {
// ProcReceive handle proc receive work
func ProcReceive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HookProcReceiveRefResult {
// TODO: Add more options?
var (
topicBranch string
Expand Down

0 comments on commit b16c312

Please sign in to comment.