Commit Graph

22154 Commits

Author SHA1 Message Date
T Mohan Aditya
32cb4740e2 fix(git): count changed file paths with spaces in code activity stats (#40569)
Git's `--numstat` output is tab-separated, but the code activity parser
split each line on whitespace. Two changed files whose names share a
first word, such as `docs/release notes.md` and `docs/release plan.md`,
were deduplicated into one entry and undercounted on the activity page.
Parse the line by its tab separators so the full path is preserved.

The contributors graph had a similar parser bug: an empty commit made it
drop the following commit, and an empty tip commit was skipped. Both
parsers now use NUL-prefixed separators that can't collide with commit
metadata.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 20:32:50 +00:00
Vu Nguyen Anh Tuan
609c808150 enhance(repo): only show blame and diff unescape buttons when needed (#40563)
The blame page and the diff file menu always offered "Unescape", even
for files without escaped characters. Blame now renders the buttons only
when `EscapeStatus.Escaped` is true, like the file view. The diff menu
decides when it opens, because escape status is only known once its
lines are rendered, which also covers expanded and later loaded lines.

| Before | After |
| --- | --- |
| <img width="441" height="48" alt="Blame before"
src="https://github.com/user-attachments/assets/f36af26d-020d-4403-ad85-da7ff9125015">
| <img width="349" height="48" alt="Blame after"
src="https://github.com/user-attachments/assets/c5ee4693-e947-421c-93f1-fd9a74440dc0">
|
| <img width="146" height="175" alt="Diff menu before"
src="https://github.com/user-attachments/assets/126d507c-5d17-45b8-bb3a-81c2256a27ed">
| <img width="146" height="137" alt="Diff menu after"
src="https://github.com/user-attachments/assets/4a6b56b8-6bec-4b9d-8c3a-dc8092c3639d">
|

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

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

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 19:45:08 +00:00
bircni
fe428123db refactor(actions): restructure run admission, settings scopes and oversized files (#39724)
Structural cleanups in the Actions code, plus fixes that align run
behaviour with GitHub Actions.

- Load a reusable caller's ancestor chain once for both expansion checks
and its dispatch inputs.
- Extract the rerun job reset and pass-through rules so they can be unit
tested.
- Share the gate a job passes once its `if:` holds (max-parallel slot,
invalid `runs-on`, concurrency group) between run insertion, rerun and
approval. The job emitter keeps its own, which also defers to groups
admitted in the same pass.
- Resolve the scope of every actions settings page, secrets included, in
one place. The variables and secrets pages dereferenced a nil context
when the org header failed to render.
- Move the API handler interface to the API router, and record runner
bulk-action audit events after the commit.
- Split the 1500 and 2200 line handler files and move the actions
converters into their own file, without code changes.
- Partial reruns load a reusable workflow at the previous attempt's
commit, full reruns resolve its ref again.
- Reject loops through the root workflow at validation.
- Compare concurrency groups case-insensitively and keep runs awaiting
approval out of them until approved.
- Fail-fast ignores failures carried over from an earlier attempt, and
reruns fail a job with an invalid `runs-on`.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 16:30:13 +00:00
Vu Nguyen Anh Tuan
77c7e17d82 docs(api): clarify merge_when_checks_succeed behavior (#40541)
`merge_when_checks_succeed` sounds like it waits for all checks, but
auto-merge only waits for branch protection requirements like required
status checks and approvals, and merges right away when none apply.

Document that in the API model without changing behavior, matching
GitHub's auto-merge and Renovate's `platformAutomerge` docs, which both
rely on required checks.

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

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

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 13:47:35 +00:00
Vu Nguyen Anh Tuan
35f717918a 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>
2026-11-27 13:47:35 +00:00
Zhaowei Gu
de28726658 test: fix unit tests on git older than 2.42 (#40557)
Gitea supports git 2.34 and newer, but with git 2.34.1 `go test
./modules/git/` panics in `TestReadingBlameOutput/sha256` (nil pointer
dereference), which aborts the rest of the package, and `services/pull`
fails its `*-MergeTree` cases with `exit status 129`. These tests use
sha256 repositories, `cat-file --batch-command` and `merge-tree
--write-tree`, which production code only uses when `DefaultFeatures()`
says git is new enough (2.42, 2.36 and 2.40).

Those cases now skip on the same `DefaultFeatures()` flags, as the
check-attr tests in `modules/git/attribute` already do. With git 2.34.1
both packages failed before; now they pass with those cases skipped, and
`make test-backend` passes as a whole. With git 2.42.0, 2.43.0 and
2.56.1 nothing is skipped; with 2.41.3 only the sha256 cases are.

Related: https://github.com/go-gitea/gitea/pull/39565

Assisted-by: Hermes Agent:claude-opus-5-5
2026-11-27 12:53:33 +00:00
Alaa Abdelwahab
e77c1c26e5 feat(diff): add rendered diff view for markup files (#40509)
Markdown, org-mode and other inline-rendered markup files get a
source/rendered toggle in commit, compare and pull request diffs, like
images and CSV. Source stays the default, matching GitHub. The rendered
diff is fetched when opened, and only offered when both the old and the
new name are markup files.

The rendered diff follows GitHub's rich diff: changed blocks get a
colored bar, words are marked inline, formatting-only changes are
underlined, code blocks are compared by line and tables by cell, with a
whole replacement when the columns of a table or row change. Math,
mermaid and emoji are shown as removed and added whole, and invisible
characters are escaped like in the source diff. A diff that takes too
long is reported like a suppressed source diff. Wiki diffs get no
toggle, and the rendered diff tab in the web editor is left for a
follow-up.

| Change | Rendered diff |
| --- | --- |
| Source stays the default | <img width="600" alt="Source stays the
default"
src="https://github.com/user-attachments/assets/87b140a6-4228-4514-8806-6897aeace766"
/> |
| Paragraphs and words | <img width="600" alt="Paragraphs and words"
src="https://github.com/user-attachments/assets/e9c3b969-fb54-43b8-a167-364a81959015"
/> |
| Formatting, links and tasks | <img width="600" alt="Formatting, links
and tasks"
src="https://github.com/user-attachments/assets/2582db39-8d28-44e1-bc19-1128f259f070"
/> |
| Lists | <img width="600" alt="Lists"
src="https://github.com/user-attachments/assets/23868a95-da05-4c41-a329-b8a06b6a94ad"
/> |
| Tables | <img width="600" alt="Tables"
src="https://github.com/user-attachments/assets/ac924a0c-33df-4d89-af2d-bb2d74309d17"
/> |
| Code blocks | <img width="600" alt="Code blocks"
src="https://github.com/user-attachments/assets/4a756005-ebf8-418f-a5a5-50520ef2ac4f"
/> |
| Math and mermaid | <img width="600" alt="Math and mermaid"
src="https://github.com/user-attachments/assets/d1c6c96f-e7f4-4ed2-9744-8677fda68bbe"
/> |

This supersedes https://github.com/go-gitea/gitea/pull/37167, whose
review raised the block-level and math/mermaid cases.

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

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 12:50:14 +00:00
bircni
ef27fb70bf enhance(actions): count cancelled checks separately in the pull request merge box (#40458)
A cancelled Actions job is stored as a `failure` commit status, so the
merge box reported a job that was only stopped as failing.

The merge box now reads the live Actions job status and counts such
checks as "canceled" in the summary, with the grey stop icon. When
nothing actually failed, the header reads "Some checks haven't completed
yet" instead of "Some checks were not successful".

Like GitHub, the stored commit status stays `failure`: commits keep the
red X, required checks still block the merge, and the API is unchanged.
Cancelled checks are listed in the failing group.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 12:48:59 +00:00
karnati praveen
17ac892df5 fix(glob): treat escaped characters as literals (#40516)
The glob compiler wrote a backslash followed by the escaped character
into the generated regexp, so `\d`, `\w`, `\s` and `\b` were parsed as
regexp constructs instead of the literal character. `a\d` compiled to
`^a\d$` and matched "a5" instead of "ad"; `a\b` became a zero-width word
boundary. Escaping a character Go does not recognise, e.g. `\C`, made
the pattern fail to compile, and protected branch rules then fell back
to matching the raw rule text literally.

Escape only ASCII punctuation, which Go always reads as a literal, and
write letters, digits and non-ASCII characters as-is. This matches
gobwas/glob and act. Rules that relied on `\d` matching a digit since
https://github.com/go-gitea/gitea/pull/35478 now match a literal `d`.

Assisted-by: OpenCode (DeepSeek V4.1 Flash)
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 06:35:30 +00:00
bircni
372d4dc97a fix(actions): normalize legacy repository runner registration tokens (#40556)
Repository runner tokens created by `gitea actions generate-runner-token
--scope owner/repo` before 1.23, or by the repository API before 1.22.2,
kept the owner ID. Migration 314 skipped this table, so these tokens
stay valid but are hidden in the settings and survive a reset. A
migration now normalizes the active ones.

Registering a runner also wrote the token back as active, which could
undo a concurrent reset. That write and the unused `UpdateRunnerToken`
are removed.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 06:22:43 +00:00
Lazizbek Ergashev
63b2af6f37 fix(web): clean up form data parsing (#40558)
`FormStrings` only parsed the form with `ParseMultipartForm`, which
returns `http.ErrNotMultipart` for urlencoded bodies, so it returned nil
unless something else had parsed the form first. The CSRF check used to
do that, and since it was removed the "Associate accessible OIDs" button
on the LFS pointers page sends no OIDs and fails with a 500. The global
multipart parse in the web and API contexts is also removed, form
helpers now parse on demand.

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

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 06:15:41 +00:00
T Mohan Aditya
c6bdd3efd6 fix(markup): continue scanning text nodes after skipped matches (#40506)
Several markup processors stopped scanning a text node after skipping
one match. An external issue or code preview URL hid later local ones,
an SSH remote like `git@host:org/repo.git` hid a later email address, a
short link with a disallowed scheme hid later short links, and a text
node ending in an ellipsis left all its URLs unlinked.

The processors now continue past skipped matches. Only a URL in the last
word of a text node ending in an ellipsis is treated as truncated.

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

Assisted-by: OpenCode:gemini-4-neon
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 05:42:42 +00:00
Abdellatif Anaflous
4f1f6d7774 fix(packages): bound decompression of uploaded package archives (#40169)
Package registries walk an uploaded archive to find its metadata,
decompressing every entry on the way with no limit, so a small crafted
archive can burn minutes of CPU. Bound the bytes read while locating
metadata to `max(512 MiB, MAX_DECOMPRESSION_RATIO × upload)`.

The ratio (default 200) scales with the upload so large regular packages
still pass, and `-1` disables the bound. The `.tar.gz` parsers open
uploads through one shared reader that applies it. Parsers already
bounded (npm, debian, helm) are left unchanged.

Docs: https://gitea.com/gitea/docs/pulls/647

Assisted-by: Claude Code:claude-opus-4-8

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-11-27 05:16:24 +00:00
silverwind
3df804d7b8 perf(pull): merge and squash pull requests without a temporary repository (#40160)
Merge and squash now run `git merge-tree` and `git commit-tree` in the
base repository and push the commit to itself, instead of building a
temporary repository per merge, which made merges take over 10 s on NFS
(https://github.com/go-gitea/gitea/issues/39410). Rebase styles,
fast-forward-only and git older than 2.40 are unchanged.

Commit and tag messages are cleaned up in one place like `git commit`
does, and merge-specific `[git.config]` overrides no longer apply to
merge and squash.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-11-27 04:42:48 +00:00
Gary Wang
d692b8d1db enhance(ui): unify all paginations into one compact style (#40514)
Server lists and the dashboard repo list rendered pagination
differently, and the server one wasted a lot of space. All pagers now
show the first, last and current page plus neighbours in seven fixed
slots, so the arrows never move. Lists with an unknown total show
Previous, Next and the current page.

<img width="672" height="383" alt="Before and after of numbered,
dashboard and previous/next pagination on first, middle and last pages,
on desktop and phone"
src="https://github.com/user-attachments/assets/c1bef79b-9579-490e-b009-d98d784b9b1c">

The pull request list now uses the same arrow between branches as the
compare page.

| Before | After |
|---|---|
| <img width="250" alt="Double chevron between branches"
src="https://github.com/user-attachments/assets/889ad911-950a-46cf-b06e-c18e06f48a29">
| <img width="250" alt="Arrow between branches"
src="https://github.com/user-attachments/assets/694ff6f9-659e-4d46-9826-b04f7cf7889a">
|

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 04:40:28 +00:00
Basavaraj S m
19c7e76ac3 fix(release): check protected tags against the user editing a release (#40464)
Editing or publishing a release can create its tag, and `createTag`
checked protected tag rules against the release publisher instead of the
user making the request. A release writer outside a protected tag's
allowlist could get that tag created by editing a release an allowlisted
user published, or by publishing an allowlisted user's draft.

`createTag` now uses the acting user for the protected tag check and for
the push and create-ref events, like `CreateNewTag`. GitHub likewise
checks tag rulesets against the user who publishes a release.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 04:05:01 +00:00
Thejesh
b6b6ef38ed fix(web): exact emoji match ranked below partial matches in autocomplete (#40493)
`matchEmoji` combined alias scores wrongly. An exact match on the main
alias scored 0, which is falsy, so a later matching alias overwrote it,
and other multi-alias matches had their scores subtracted. Typing `:car`
did not suggest 🚗 at all and `:boat` listed `rowboat` before `boat`.

Each emoji now keeps its best alias score, and an exact match on any
alias ranks first, like on GitHub, so `:uk` suggests 🇬🇧 before 🇺🇦.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 03:59:50 +00:00
Matthew Tirtawidjaja
073a966227 fix(ui): wrap long unbroken text in profile card and sidebars (#40535)
- Long text without natural break points, such as email addresses, URLs
and names containing underscores, no longer overflows the profile card,
the package title and sidebar, the repository sidebar, the organization
header and the stargazer, watcher and follower cards.
- These containers use `overflow-wrap: anywhere`, because the global
`overflow-wrap: break-word` does not let flex items shrink below their
longest word.
- The profile card icon rows share one layout again, so location, email
and website align the same way.
- An empty topics row no longer adds extra space around "Manage Topics"
in the repository sidebar.
- Cancelling or saving the topic editor keeps an empty topics row
hidden, instead of showing it again until the next page load.
- The package view uses its own header class instead of borrowing the
issue title one.

<img width="688" alt="Before and after"
src="https://github.com/user-attachments/assets/d1417853-d6ce-4797-b26d-1a2ead67608c">

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-27 03:50:01 +00:00
silverwind
4f45df1727 chore: drop obsolete renovate pins, test against PostgreSQL 15 (#40528)
PostgreSQL 14 reached end of life on 2026-11-12, so CI moves to 15, the
oldest supported major.

Also drops two Renovate pins that do nothing: `@mcaptcha/vanilla-glue`
has had no release since the pinned `0.1.0-rc2`, and the `gomodMod`
constraint equals the `@latest` Renovate installs by default.

Changes to the DB test workflow or the `pgsql-shard` action now trigger
all DB tests. Before, only SQLite ran, so a PostgreSQL bump like this
one went untested.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 02:47:01 +00:00
GiteaBot
483d546231 [skip ci] Updated translations via Crowdin 2026-11-27 00:34:28 +00:00
silverwind
14d2bdc19a refactor: replace cropperjs with @github/image-crop-element (#40530)
Replace cropperjs, which was stuck on v1 because v2 was too complex to
migrate to, with `@github/image-crop-element`, the cropper GitHub uses
(2.3 KB vs 14.5 KB gzipped). A full selection of a square image uploads
the original file so animated avatars keep working, any other selection
uploads the selected square as PNG.

Custom element events are now typed via `HTMLElementEventMap`, removing
event casts.

<img width="208" height="208" alt="Avatar crop panel with the Gitea
logo"
src="https://github.com/user-attachments/assets/dbdc2744-592a-45ea-91d2-356c34a0d52b">

Ref: https://github.com/go-gitea/gitea/pull/33827

Assisted-by: Claude Code:claude-opus-5-5
2026-11-26 13:40:23 +00:00
bircni
34ef7ae9e4 chore: stop accepting security reports by mail (#40544)
The volume of reports sent to `security@gitea.io` can no longer be
handled, so vulnerability reports are now only accepted through GitHub
security advisories. The security policy says so explicitly, and the
README, contributing guide and issue templates point to the advisory
form instead of the mail address.

The address stays for security matters that are not vulnerability
reports, such as questions about the policy or coordinating the
disclosure of an existing advisory.
2026-11-26 12:51:44 +00:00
Myers Carpenter
eddd00278b fix(api): exclude code comments from the timeline query, not after paging (#40511)
The issue timeline API paged the comment query and then dropped code
comments from the page, so pages could come back short or empty while
later pages still held events, and clients that stop at such a page
missed them. Code comments are now excluded in the query itself.

Comments the doer cannot read are still filtered after paging, and
`X-Total-Count` still reflects the page length. Both are left for a
follow-up. Independent of https://github.com/go-gitea/gitea/pull/40496
and https://github.com/go-gitea/gitea/pull/40497.

Refs: https://github.com/go-gitea/gitea/issues/40495

Assisted-by: Claude:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-26 11:06:46 +00:00
bircni
933ab82a16 feat: add merge queue (#40431)
Adds a merge queue for protected branches, modeled on GitHub's. Merging
into a branch that requires it queues the pull request, tests it with
the ones ahead of it in `merge_group` runs and fast-forwards the base
once the required checks pass. Failing or conflicting pull requests are
removed.

Rules configure merge method, group sizes, grouping and timeouts. Each
queue has a page at `/{owner}/{repo}/queue/{branch}`. The API can queue,
jump, look up and remove a pull request and list or clear a queue, and
webhooks and Actions get the `merge_group` event and
`enqueued`/`dequeued` actions. The merge box's command line hint now
sits beside the merge buttons like on GitHub, also outside of merge
queues.

One notable difference from GitHub is that Gitea allows merge queue to
be enabled in any repo, as opposed to GitHub which only allows it in
organization repos.

| View | Screenshot |
| --- | --- |
| Merge box, ready | <img width="440" alt="Merge box, ready"
src="https://github.com/user-attachments/assets/7d2ac984-90c4-4744-8ac8-5daf37cd96e9"
/> |
| Merge box, queued | <img width="440" alt="Merge box, queued"
src="https://github.com/user-attachments/assets/33b85cab-dfd6-405f-8ffd-283cd920e59f"
/> |
| Pull request header, queued | <img width="600" alt="Pull request
header, queued"
src="https://github.com/user-attachments/assets/d61c635b-8552-4b47-a900-e493912e8c16"
/> |
| Timeline, removal after failed checks | <img width="440"
alt="Timeline, removal after failed checks"
src="https://github.com/user-attachments/assets/bee95e79-4c76-4592-ad35-82109d9da4ed"
/> |
| Queue page | <img width="600" alt="Queue page"
src="https://github.com/user-attachments/assets/847a595a-1e13-4099-aa37-7f44018dc188"
/> |
| Pull request list, queued | <img width="600" alt="Pull request list,
queued"
src="https://github.com/user-attachments/assets/a382a143-a67f-4298-aa11-594e281d54db"
/> |
| Merge queue settings | <img width="600" alt="Merge queue settings"
src="https://github.com/user-attachments/assets/cdaf4aa5-350e-4570-a095-c91c41d03cde"
/> |

Fixes: https://github.com/go-gitea/gitea/issues/36392
Docs: https://gitea.com/gitea/docs/pulls/655

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
2026-11-26 10:50:01 +00:00
Sweepy
6057629e7d ci: enable BuildKit SBOM attestations for container images (#40529)
Enable `sbom: true` on the regular and rootless container build steps in
the tag and nightly release workflows so BuildKit attaches SPDX SBOM
attestations alongside published multi-arch images.

Publishing image SBOMs lets downstream users and tools inspect package
inventories and surface CVEs without pulling full image layers — for
example, [Count Patchula](https://count-patchula.sweepy.dev) compares
image SBOMs against OSV.dev when proposing container updates.

Workflow syntax was validated with `actionlint`. Runtime image contents
are unchanged.

Assisted-by: Antigravity:Gemini
2026-11-26 01:58:15 +00:00
Mitrahsoft
563d8ecba5 fix(ssh): create host key directory with 0700 permissions (#40517)
The built-in SSH server created a missing host key directory with
`os.ModePerm`, leaving it readable by all users. `gitea generate ssh
host-keys` created it with 0644, which lacks the execute bit, so the
keys could not be written into it.

`InitDefaultHostKeys` now creates the directory, including missing
parents, with 0700 for both callers. Existing directories keep their
permissions.

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

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-26 01:57:38 +00:00
Kowalski Dragon
b888671594 fix(packages): repair Debian and RPM signing keys rejected by Sequoia (#40240)
Until 1.23.2, Gitea generated Debian and RPM signing keys with
keybase/go-crypto. About half of them carry a malformed user ID
self-signature that Sequoia (sqv in Debian 13, rpm-sequoia in Fedora)
rejects, so apt and rpm refuse the repository. A migration re-signs the
affected self-signature in place.

The key and its fingerprint stay the same, so working clients are
unaffected and failing ones only re-download `repository.key`. Debian
Release files signed before 1.23.2 are malformed as well and get
re-signed on the next upload to their distribution.

Fixes: https://github.com/go-gitea/gitea/issues/35588
Assisted-by: Claude Code:claude-opus-5-5

---------

Signed-off-by: Kowalski Dragon (kowalski7cc) <kowalski7cc@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 15:42:11 +00:00
Lunny Xiao
d821a986ef perf(auth): store tokens as SHA-256 and throttle last-used writes (#39933)
Store PAT, Actions task and runner tokens as SHA-256 instead of PBKDF2,
which 160-bit random tokens don't need, and drop the token caches and
`SUCCESSFUL_TOKENS_CACHE_SIZE` that PBKDF2 required. Legacy rows are
rehashed on first use. Older releases can't verify new or rehashed
tokens. A PAT use now writes only its last-used timestamp, at most once
a minute.

Benchmarks on M2 Max, SQLite, median of 5:

| Benchmark | 1 token | 128 tokens |
| :--- | ---: | ---: |
| PAT lookup | 29.4 → 30.7 µs | 2.24 ms → 29.7 µs |
| PAT lookup with last-used | 107 → 29.6 µs | 2.44 ms → 30.1 µs |
| Task lookup | 63.2 → 48.4 µs | 2.25 ms → 49.4 µs |
| Runner verify, no DB | 122 → 160 ns | 141 → 162 ns |

Docs: https://gitea.com/gitea/docs/pulls/607

Assisted-by: Codet
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 15:36:10 +00:00
Lunny Xiao
02b5bbacab fix(release): order the release list by publication time (#39714)
Releases are listed by `created_unix`, which is the date of the tagged
commit since #36761. A patch release tagged on an older branch commit
(e.g. 1.24.x after 1.25.0) therefore sorts out of publication order, so
the newest release is not always at the top.

List by publication time instead, falling back to the commit date for
drafts. The latest-release badge is unchanged, so an old commit still
cannot take it over.

---
Assisted-by: Codet:claude

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 15:28:01 +00:00
Christmas
a46dea6651 fix(mirror): keep repository update times out of the future (#40481)
A pull mirror copied its newest branch tip's committer date into the
repository's "Last updated" field. Commit dates are set by whoever made
the commit, so a single tip dated 2098 kept an idle mirror at the top of
Explore for decades.

Like GitHub, GitLab and Gitea's own push handling, a sync now sets the
update time to the sync time when any ref changed and leaves it
untouched otherwise.

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

Assisted-by: Codex:GPT-6
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 10:39:43 +00:00
silverwind
812406423b fix(actions): run workflows on the event's commit (#40112)
Queued push, create and pull request synchronize events resolved their
branch only when handled, so if it had moved on, the pushed commit got
no run and the newer one got two.

Runs now use the event's commit, and a delayed default branch push no
longer replaces newer schedules.

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-11-25 03:55:01 +00:00
Shudhanshu Singh
6a68717cec fix(packages): preserve CRAN metadata continuation lines (#40438)
Indented continuation lines containing colons were mistaken for new
fields, truncating CRAN package descriptions and dropping project URLs.

Continuation lines are now kept for space and tab indentation. Project
URLs are extracted from the `URL` field, which R allows to be separated
by commas or whitespace, so wrapped URL lists no longer become one
broken link and labels like `(devel)` are not linked.

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 03:29:44 +00:00
silverwind
a4d38a5d64 enhance(api): add admin actions variables API (#40522)
Adds `/api/v1/admin/actions/variables` so instance-level actions
variables can be managed outside the admin UI. All variable scopes now
share one handler implementation and one test.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-25 03:27:49 +00:00
Lunny Xiao
7a4860734d refactor: check git exit code through an interface instead of *exec.ExitError (#40447)
`gitcmd.IsErrorExitCode` now matches any error exposing `ExitCode()
int`, which `*exec.ExitError` does, instead of asserting the concrete
type, and `Commit.HasPreviousCommit` uses it instead of its own type
assertion.

Exit code checks should not depend on how a command was run, so a
command runner other than `os/exec` can report exit codes without
touching callers. No behavior change.

Assisted-by: Codet:claude
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 00:24:06 +00:00
Lunny Xiao
3ce3c1277a refactor: make git.Push take a repository instead of a local path (#40448)
`git.Push` took a raw local path and ran the command with `WithDir`. It
now takes a `RepositoryFacade` and uses `WithRepo`, like the other
repository commands, and `PushFromLocal` wraps its path with
`gitrepo.RepositoryUnmanaged`.

Unmanaged repositories resolve relative paths under the repository root,
so a relative `APP_TEMP_PATH` is now made absolute at load. It already
broke repository auto-init and would otherwise also break wiki and file
edit pushes. No other behavior change.

Assisted-by: Codet:claude
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-25 00:18:50 +00:00
Gal Be
42d09b71d3 perf(markdown): stop building a new markdown converter for every render (#40515)
Each render built a new goldmark converter. For short texts, such as
comments, this was most of the cost. Now `render` reuses converters from
a `sync.Pool`, as the TODO in `SpecializedMarkdown` suggested. Each
converter gets the `RenderInternal` of the render. The HTML output does
not change.

| Benchmark | Before | After | Allocs |
|---|---:|---:|---|
| Comment | 85.0 µs | 46.0 µs | 502 → 207 |
| `BenchmarkMarkdownRender` | 100.5 µs | 62.8 µs | 536 → 241 |
| README | 1.51 ms | 1.50 ms | 9679 → 9384 |

No benchmark got slower (AMD EPYC 9V74, Go 1.27.4, 24 rounds).

Checks:
- `go test ./modules/markup/...` and golangci-lint pass.
- Old and new HTML matched on 20,000 random documents.
- Parallel renders pass with `-race`.

Claude was used for this change. I reviewed and tested it.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-24 16:19:41 +00:00
silverwind
b1a6cdadc8 enhance: deprecate minio storage naming, switch to rustfs on ci (#37545)
Use provider-neutral S3 naming for object storage and switch CI to
RustFS.

1. Rename `STORAGE_TYPE = minio` to `s3`, `[storage.minio]` to
`[storage.s3]`, and `MINIO_*` keys to `S3_*`. Legacy configs resolve as
before and log deprecation warnings. Explicit `S3_*` keys take
precedence in the same section.
2. Rename `migrate-storage` options to `--storage=s3` and `--s3-*`,
retaining deprecated `minio` aliases.
3. Replace MinIO in CI with RustFS `1.0.6` and rename
`TEST_MINIO_ENDPOINT` to `TEST_S3_ENDPOINT`.

Docs: https://gitea.com/gitea/docs/pulls/659

Assisted-by: Claude Code:claude-opus-5-5

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-11-24 06:13:13 +00:00
GiteaBot
58e728ebe4 [skip ci] Updated translations via Crowdin 2026-11-24 00:31:09 +00:00
Giteabot
6824aef6fc chore(deps): update dependencies (#40499)
Update Go, JS, Python and CI dependencies, including
`@stylistic/eslint-plugin` 6 and `eslint-plugin-unicorn` 80.

- `gopkg.in/ini.v1` 1.68.0 keeps `;` and `#` in quoted `app.ini` values,
so the security test asserts the full value
- Drop stylistic rules replaced by `list-style`, which stays off as it
also enforces wrapping
- Configure new unicorn and typescript-eslint rules, drop ones
deprecated in typescript-eslint 8.64
- Remove the unused `partialOptions` from the workflow graph helpers

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-23 22:07:54 +00:00
delvh
021f56854c docs: Define the role of the API (#40382)
As per TOC decision, the UI is the ultimate source of truth.
The API is only secondary in nature.

---------

Signed-off-by: delvh <dev.lh@web.de>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
2026-11-23 18:37:34 +00:00
Zhaowei Gu
8b1b80bbf2 test: fix TestGitDiffTreeRespectsDiffOrderFile on git older than 2.46 (#40492)
`TestGitDiffTreeRespectsDiffOrderFile` fails on git older than 2.46,
such as the 2.43 that Ubuntu 24.04 ships, even though Gitea supports git
2.34 and newer. Its `GlobalDiffOrderFile` subtest sets and removes the
global `diff.orderFile` with `git config set` and `git config unset`,
which were added in git 2.46, so older git stops it at the first call
with `exit status 129 - usage: git config [<options>]`.

The test now uses `git config --global` and `git config --global
--unset`, the classic syntax that `modules/git/config.go` also uses.
With git 2.34.1 and 2.43.0 the test failed before and passes now; git
2.56.1 passes either way.

Follow-up to https://github.com/go-gitea/gitea/pull/38566

Assisted-by: Hermes Agent:claude-opus-5-5
2026-11-23 12:31:39 +00:00
GiteaBot
c04f64824b [skip ci] Updated translations via Crowdin 2026-11-23 00:37:08 +00:00
linzch3
293b635e22 refactor: add bound limit for JSON decoders (#40465)
Fix various call sites including:

* Fixes #40457
* Fixes #40456

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: linzch3 <20380442+linzch3@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-11-22 10:18:51 +00:00
Wei-Lun Li
7d1bc574f6 perf(markup): skip mention, email and commit regexps for text without "@" (#40471)
Post-processing runs the mention, email and cross-repo commit reference
regexps on every text node of rendered markdown, issue titles and commit
messages. All three patterns need an `@`, but none starts with a literal
the regexp engine can search for, so they took most of the
post-processing time even on text without one. Checking for `@` first
skips them with the same results.

Local Go benchmarks, i7-9700 on Windows 11, base and patched run
alternately 6 times, medians:

| | before | after |
|---|---|---|
| Markdown render of README + CONTRIBUTING + 3 docs (45 KB) | 16.1 ms |
11.4 ms |
| `PostProcessCommitMessageSubject` on the last 200 commit subjects of
this repo | 5.14 ms | 3.53 ms |
| `PostProcessIssueTitle` on the same 200 lines | 3.57 ms | 2.59 ms |

Assisted-by: Claude Code:claude-opus-5-5
2026-11-22 10:06:24 +00:00
Zhaowei Gu
890effbc91 fix: drain in-flight requests on SIGTERM and close idle connections promptly (#40472)
`gitea web` derived the graceful manager's context from the CLI context,
which is canceled on the first SIGTERM, so in-flight requests were
force-closed and the terminate stage never ran.

- Detach the manager's context from that cancellation. With
`SKIP_MINWINSVC=1` on Windows, Ctrl+C now takes two.
- Close idle HTTP/2 connections at shutdown, which otherwise held every
drain until the hammer.

| SIGTERM with | main | this PR |
|---|---|---|
| no connections | 0.01s, no terminate stage | 1.03s |
| 64 MiB download in flight | cut after 10 MB | completes |
| idle HTTP/2 connection | 0.01s | 1.01s |

Regressed in: https://github.com/go-gitea/gitea/pull/35348
Carries forward https://github.com/go-gitea/gitea/pull/39533 by
@mandel-macaque.

Assisted-by: Hermes Agent:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-11-22 10:05:40 +00:00
silverwind
2b843af2b8 refactor(actions): use shared workflow validation from actionslib (#40475)
Gitea and the runner each implemented the same GitHub Actions rules.
Workflow structure, job kind, `runs-on`, `run-name` and job condition
checks, step display names, the output and step summary limits and the
reusable workflow depth now come from actionslib, so both enforce the
same rules. Job condition and `run-name` context errors now use GitHub's
wording with the position of the expression.

The shared rules come from https://gitea.com/gitea/actionslib/pulls/34,
released in actionslib v1.7.0. The runner side is
https://gitea.com/gitea/runner/pulls/1421.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-22 10:05:01 +00:00
GiteaBot
664ee14419 [skip ci] Updated translations via Crowdin 2026-11-22 00:36:17 +00:00
delvh
fed85cec5f docs: Define project roles, permissions, and obligations (#40487)
As per the Core team's decision,
we will define the roles inside the Gitea project as follows:

Maintainer --> Contributor
Merger --> Maintainer
TOC --> Core team

Main changes:
- Adapt wording to the new definitions
- Contributors who are inactive for more than three months will lose
their contributor status, but can be re-added on demand
- Describe how to become a contributor more clearly
- Describe how the core team works more clearly

The inactivity rule will only apply starting 2026-12-01 (so it will not
be enforced before March).
Everything else becomes effective immediately.

---------

Co-authored-by: bircni <bircni@icloud.com>
2026-11-21 23:12:02 +00:00
silverwind
e1d2e94ab0 enhance(actions)!: run pull_request_target workflows from the default branch (#40440)
Like GitHub since December 2025, `pull_request_target` workflows now run
from the default branch whatever the pull request targets, so an
outdated workflow on a release branch can't run with secrets.

`github.ref`, `github.sha` and local reusable workflows follow it, while
branch filters still match the base. Runs now record that ref, so runs
from older versions keep the base on rerun.

Breaking: pull requests targeting a non-default branch now run the
default branch's `pull_request_target` workflows, so workflows that only
exist on that branch stop running and `actions/checkout` without `ref`
checks out the default branch.

Ref:
https://github.blog/changelog/2025-11-07-actions-pull_request_target-and-environment-branch-protections-changes/

Assisted-by: Claude Code:claude-opus-5-5
2026-11-21 18:52:39 +00:00
李浩然
e03fcadc69 enhance(release): show mentioned contributors (#39768)
Show the users @mentioned in release notes as a row of avatars in a
Contributors section below the notes, like GitHub does on its release
pages. Mentions in the notes stay plain links, as on GitHub.

Only active users the viewer can see are listed, in order of first
mention.

| Before | After |
| --- | --- |
| <img width="260" height="77" alt="before"
src="https://github.com/user-attachments/assets/83c015f7-92eb-48da-b09c-42371497d61e"
/> | <img width="260" height="150" alt="after"
src="https://github.com/user-attachments/assets/1467bc1e-59df-42d5-8989-165a502bdb0e"
/> |

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

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: 李浩然 <lihaoran@gzweiti.com>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-21 18:48:44 +00:00