fix(settings): unify glob documentation links (#40539)

Unify the glob help texts on the protected branch, protected tag and
webhook settings pages. All glob syntax links point to the gobwas/glob
syntax section with matching link text. The file pattern examples
replace `.drone.yml` and `/docs/**/*.txt`, which never matched because
changed paths have no leading slash, with `.gitea/workflows/**` and
`CODEOWNERS` for protected files and `docs/**` and `**.md` for
unprotected files.

Links and code markup move from the translations into the templates, and
the English texts are shortened. The changed strings use new keys, so
other locales fall back to English until they are translated instead of
rendering mismatched placeholders.

<img width="838" height="465" alt="Before and after of the glob help
texts"
src="https://github.com/user-attachments/assets/beabc67d-c8be-4926-ac72-31aa4b726f5b">

Fixes: https://github.com/go-gitea/gitea/issues/39694

Assisted-by: OpenCode:hy4-flash-free
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Vu Nguyen Anh Tuanandsilverwind authored and GitHub committed 2026-11-27 13:47:35 +00:00
1 parent de28726658
commit 35f717918a
4 files changed
+16 -16

No files matched your search

+8 -8
View File
@@ -2438,9 +2438,9 @@
"repo.settings.event_package": "Package",
"repo.settings.event_package_desc": "Package created or deleted in a repository.",
"repo.settings.branch_filter": "Branch filter",
"repo.settings.branch_filter_desc_1": "Branch (and ref name) allowlist for push, branch creation, branch deletion and merge group events, specified as glob pattern. If empty or <code>*</code>, events for all branches and tags are reported.",
"repo.settings.branch_filter_desc_2": "Use <code>refs/heads/</code> or <code>refs/tags/</code> prefix to match full ref names.",
"repo.settings.branch_filter_desc_doc": "See <a href=\"%[1]s\">%[2]s</a> documentation for syntax.",
"repo.settings.branch_filter_desc": "Glob of branch or ref names for push, branch creation, branch deletion and merge group events. Empty or %[1]s matches all branches and tags. Use a %[2]s or %[3]s prefix to match full ref names.",
"repo.settings.glob_syntax_desc": "See %s for syntax.",
"repo.settings.glob_examples": "Examples: %s.",
"repo.settings.authorization_header": "Authorization Header",
"repo.settings.authorization_header_desc": "Will be included as authorization header for requests when present. Examples: %s.",
"repo.settings.active": "Active",
@@ -2495,7 +2495,7 @@
"repo.settings.protected_branch_can_push": "Allow push?",
"repo.settings.protected_branch_can_push_yes": "You can push",
"repo.settings.protected_branch_can_push_no": "You cannot push",
"repo.settings.branch_protection": "Branch Protection Rules for Branch '<b>%s</b>'",
"repo.settings.branch_protection_title": "Branch Protection for %s",
"repo.settings.protect_this_branch": "Enable Branch Protection",
"repo.settings.protect_this_branch_desc": "Prevents deletion and restricts Git pushing and merging to the branch.",
"repo.settings.protect_disable_push": "Disable Push",
@@ -2556,12 +2556,11 @@
"repo.settings.require_signed_commits": "Require Signed Commits",
"repo.settings.require_signed_commits_desc": "Reject pushes to this branch if they are unsigned or unverifiable.",
"repo.settings.protect_branch_name_pattern": "Protected Branch Name Pattern",
"repo.settings.protect_branch_name_pattern_desc": "Protected branch name patterns. See <a href=\"%s\">the documentation</a> for pattern syntax. Examples: main, release/**",
"repo.settings.protect_patterns": "Patterns",
"repo.settings.protect_protected_file_patterns": "Protected file patterns (separated using semicolon ';'):",
"repo.settings.protect_protected_file_patterns_desc": "Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href='%[1]s'>%[2]s</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.",
"repo.settings.protect_protected_files_desc": "Files that can't be changed directly, even with write access.",
"repo.settings.protect_unprotected_file_patterns": "Unprotected file patterns (separated using semicolon ';'):",
"repo.settings.protect_unprotected_file_patterns_desc": "Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (';'). See <a href='%[1]s'>%[2]s</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.",
"repo.settings.protect_unprotected_files_desc": "Files that users with write access can change directly, bypassing push restrictions.",
"repo.settings.add_protected_branch": "Enable protection",
"repo.settings.delete_protected_branch": "Disable protection",
"repo.settings.update_protect_branch_success": "Branch protection for rule \"%s\" has been updated.",
@@ -2615,7 +2614,8 @@
"repo.settings.tags.protection.allowed.noone": "No One",
"repo.settings.tags.protection.create": "Protect Tag",
"repo.settings.tags.protection.none": "There are no protected tags.",
"repo.settings.tags.protection.pattern.description": "You can use a single name or a glob pattern or regular expression to match multiple tags. Read more in the <a target=\"_blank\" rel=\"noopener\" href=\"%s\">protected tags guide</a>.",
"repo.settings.tags.protection.pattern.help": "A tag name, glob or regular expression. See the %s.",
"repo.settings.tags.protection.guide": "protected tags guide",
"repo.settings.bot_token": "Bot Token",
"repo.settings.chat_id": "Chat ID",
"repo.settings.thread_id": "Thread ID",
@@ -3,7 +3,7 @@
<form class="ui form form-fetch-action" action="{{.Link}}" method="post">
<h4 class="ui top attached header">
{{if .Rule.RuleName}}
{{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}}
{{ctx.Locale.Tr "repo.settings.branch_protection_title" (HTMLFormat "<b>%s</b>" .Rule.RuleName)}}
{{else}}
{{ctx.Locale.Tr "repo.settings.branches.add_new_rule"}}
{{end}}
@@ -14,17 +14,18 @@
<label>{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern"}}</label>
<input name="rule_name" type="text" value="{{.Rule.RuleName}}" required>
<input name="rule_id" type="hidden" value="{{.Rule.ID}}">
<p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern_desc" "https://github.com/gobwas/glob"}}</p>
{{$globSyntax := ctx.Locale.Tr "repo.settings.glob_syntax_desc" (HTMLFormat `<a href="%s">%s</a>` "https://github.com/gobwas/glob#syntax" "github.com/gobwas/glob")}}
<p class="help tw-ml-0">{{$globSyntax}} {{ctx.Locale.Tr "repo.settings.glob_examples" (HTMLFormat "<code>%s</code>, <code>%s</code>" "main" "release/**")}}</p>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns"}}</label>
<input name="protected_file_patterns" type="text" value="{{.Rule.ProtectedFilePatterns}}">
<p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</p>
<p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_protected_files_desc"}} {{$globSyntax}} {{ctx.Locale.Tr "repo.settings.glob_examples" (HTMLFormat "<code>%s</code>, <code>%s</code>" ".gitea/workflows/**" "CODEOWNERS")}}</p>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns"}}</label>
<input name="unprotected_file_patterns" type="text" value="{{.Rule.UnprotectedFilePatterns}}">
<p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</p>
<p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_unprotected_files_desc"}} {{$globSyntax}} {{ctx.Locale.Tr "repo.settings.glob_examples" (HTMLFormat "<code>%s</code>, <code>%s</code>" "docs/**" "**.md")}}</p>
</div>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_push"}}</h5>
+1 -1
View File
@@ -20,7 +20,7 @@
<div class="ui input">
<input class="prompt" name="name_pattern" autocomplete="off" value="{{.name_pattern}}" placeholder="v*" autofocus required>
</div>
<div class="help">{{ctx.Locale.Tr "repo.settings.tags.protection.pattern.description" "https://docs.gitea.com/usage/protected-tags"}}</div>
<div class="help">{{ctx.Locale.Tr "repo.settings.tags.protection.pattern.help" (HTMLFormat `<a target="_blank" rel="noopener" href="%s">%s</a>` "https://docs.gitea.com/usage/protected-tags" (ctx.Locale.Tr "repo.settings.tags.protection.guide"))}}</div>
</div>
</div>
<div class="whitelist field">
@@ -51,9 +51,8 @@
<label>{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label>
<input name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}">
<span class="help">
{{ctx.Locale.Tr "repo.settings.branch_filter_desc_1"}}
{{ctx.Locale.Tr "repo.settings.branch_filter_desc_2"}}
{{ctx.Locale.Tr "repo.settings.branch_filter_desc_doc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}
{{ctx.Locale.Tr "repo.settings.branch_filter_desc" (HTMLFormat "<code>%s</code>" "*") (HTMLFormat "<code>%s</code>" "refs/heads/") (HTMLFormat "<code>%s</code>" "refs/tags/")}}
{{ctx.Locale.Tr "repo.settings.glob_syntax_desc" (HTMLFormat `<a href="%s">%s</a>` "https://github.com/gobwas/glob#syntax" "github.com/gobwas/glob")}}
<ul>
<li><code>main</code></li>
<li><code>{main,feature/*}</code></li>