Commit Graph

22134 Commits

Author SHA1 Message Date
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
silverwind
c64dba88bd fix(actions): find runs awaiting approval behind stale commit statuses (#40476)
The "Approve runs" button was missing on
https://gitea.com/gitea/runner/pulls/1246. The merge box only looked at
the latest commit status per context, so an older run's later update,
like its cancellation, hid a newer run still awaiting approval. It now
collects runs from all statuses of the head commit.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-21 14:40:12 +00:00
silverwind
535a05345b enhance(markup): highlight mentions of the current user (#40474)
Render user mentions like GitHub, semibold in the surrounding text
color, and highlight mentions of the signed-in user in yellow so they
stand out in long threads.

The renderer adds `user-mention` and `current-user` classes, the styling
is pure CSS. CODEOWNERS and OAuth creator links use the same class, team
mentions are unchanged.

| Before | After |
| --- | --- |
| <img width="291" height="29" alt="before"
src="https://github.com/user-attachments/assets/6c451e7a-dfce-4e95-a386-f9aa9d28c721"
/> | <img width="291" height="29" alt="after"
src="https://github.com/user-attachments/assets/6b137c71-4692-46f2-adf8-d77ee87f3077"
/> |

Assisted-by: Claude Code:claude-opus-5-5
2026-11-21 14:39:11 +00:00
Mitrahsoft
6f8ebc0b2f fix(web): drop placeholder "avatar" tooltip from nameless avatars (#40468)
Hovering the avatar of a commit signed with the instance's signing key
showed a native browser tooltip "avatar" on top of the key fingerprint
tooltip. Avatars rendered without a name no longer get this placeholder
`title`. The signer name stays in the lock icon's tooltip.

This also removes the meaningless "avatar" tooltip from other nameless
avatars, like co-authors that only have an email. Avatars with a name
keep their `title`.

| Before | After |
| --- | --- |
| <img width="112" height="70" alt="before"
src="https://github.com/user-attachments/assets/5bc9a702-c31d-48f2-a054-d838cb5f78d3"
/> | <img width="112" height="70" alt="after"
src="https://github.com/user-attachments/assets/5696a7b9-7000-4060-95db-6ed7ef67b9a3"
/> |

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

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

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-21 08:59:34 +00:00
Sharanya L Shetty
cff4f1e0f3 refactor: split preReceiveBranch checks into smaller functions (#40463)
Part of #35015.

`preReceiveBranch` in `routers/private/hook_pre_receive.go` was about
190 lines. This moves three of its checks into their own functions:

- `checkForcePush`: detects a force push and rejects it if the branch
doesn't allow it
- `checkSignedCommits`: rejects unverified commits when signing is
required
- `checkProtectedFiles`: reports whether the push changes a protected
file

No behaviour change: same checks, same order, same error messages. Each
helper returns `ok = false` only after it has written the error
response, so `preReceiveBranch` stops exactly where it stopped before.

`go test ./routers/private/...` passes.

AI disclosure: I used Claude to help plan the split and draft the helper
functions. I reviewed each change against the original code and ran the
tests myself.
2026-11-21 03:38:09 +00:00
silverwind
c9273a5a59 test: wait for indexer startup before loading fixtures (#40467)
Integration tests load fixtures after the app starts, while the indexers
still initialize and populate in the background. A slow start indexed
every fixture repo or dropped early index updates, making search tests
flaky.

The indexer startup goroutines now join a WaitGroup that only the test
harness waits on. This replaces the issue indexer's `syncReindex` flag.
Also fixes a flaky `SyncDirs` test that relied on directory listing
order.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-21 02:43:03 +00:00
GiteaBot
4a9a53d79a [skip ci] Updated translations via Crowdin 2026-11-21 00:33:34 +00:00
Shudhanshu Singh
47f627870d enhance(webhooks): show live delivery status in history (#40389)
A webhook delivery looked failed while its HTTP request was still in
flight. Recent Deliveries now tells the states apart and refreshes in
place while a delivery is pending.

- Rows show queued, in progress, succeeded or failed, plus the HTTP
status code
- Transport failures show as timed out, connection failed or blocked by
the outbound request policy
- Test Push Event and the 5s polling update the list without a page
reload
- Details open in a dialog, times render in the viewer's timezone

| | Before | After |
|-|-|-|
| List | <img width="600" alt="Recent deliveries before"
src="https://github.com/user-attachments/assets/c5fa2217-91d4-4278-bdd2-fc7e98f47bd7"
/> | <img width="600" alt="Recent deliveries after"
src="https://github.com/user-attachments/assets/0b91706e-ab5b-4fed-97f0-30c28e374f50"
/> |
| Details | <img width="600" alt="Delivery details before"
src="https://github.com/user-attachments/assets/04fcae63-de09-4906-96d9-bcea4e15550f"
/> | <img width="216" height="207" alt="Delivery details after"
src="https://github.com/user-attachments/assets/9c0f68a4-2dcf-4fd3-b4e0-31f4f031465f"
/> |

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

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

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-20 08:52:15 +00:00
Lunny Xiao
9ed44be714 feat: record and expose SHA-256 for attachments (#39954)
Release assets and other attachments had no content digest, so tools
that download release binaries could not verify them. This records one
and shows it on the releases page in a GitHub-like asset list.

- Record the SHA-256 of each attachment while it streams to storage,
migrated release assets included
- Return it as `digest: "sha256:<hex>"` in the attachment API, the field
GitHub uses for release assets
- Lay out release assets in columns for digest with copy button,
download count, size and date, stacked under the name on narrow screens
- Rename the "Downloads" section to "Assets" and show the asset count
- Attachments uploaded before this have no digest, backfilling them is
left for a follow-up

| Before | After |
| --- | --- |
| <img width="600" alt="before-desktop"
src="https://github.com/user-attachments/assets/d6f290b4-5fba-4ee2-86c0-82c0bd77f702"
/> | <img width="600" alt="after-desktop"
src="https://github.com/user-attachments/assets/11bafe88-331d-4e96-9455-87774db539d8"
/> |
| <img width="360" alt="before-mobile"
src="https://github.com/user-attachments/assets/22a83b07-ca43-4cc6-8d2a-c1fc92a32dfe"
/> | <img width="370" alt="after-mobile"
src="https://github.com/user-attachments/assets/d013b7d1-0683-4983-9864-5dbc7844f27d"
/> |

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-20 08:47:30 +00:00
silverwind
b2e54a7b18 perf: avoid commit status summary full table scan (#40451)
The dashboard repo list read the entire `commit_status_summary` table on
every load when the page held an empty repo and the other repos'
statuses were cached, about 1.2 s with 1M rows. Those other repos also
showed and cached the status of an arbitrary older commit.

Also fixes the MySQL upsert not updating `target_url`.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-20 08:17:52 +00:00
gritse
0b381e8e4e fix(packages): build NuGet registry URLs from the request host (#40405)
The NuGet registry puts `ROOT_URL` into every absolute URL it returns
(v3 service index, v2 service document, search, registration, version
listing), no matter which address the client used. A client which
reaches Gitea on another address, for example CI pods using the
in-cluster Service while `ROOT_URL` is the ingress hostname, gets links
it cannot follow, so `dotnet restore` fails.

This is the same problem as #29591 for the container registry, fixed in
#30885. The npm registry also follows the request host already.

## Change

`routers/api/packages/nuget/nuget.go` built the base URL from
`setting.AppURL` in 8 places. They now go through one helper,
`buildNuGetRegistryURL`, which uses `httplib.GuessCurrentAppURL(ctx)`.

- With the default `PUBLIC_URL_DETECTION = auto`, the returned URLs
follow the request (`Host`, and `X-Forwarded-Proto` when a reverse proxy
sends it).
- With `PUBLIC_URL_DETECTION = never`, they stay on `ROOT_URL` as
before.
- Requests on the `ROOT_URL` address get the same URLs as before.

## Testing

- `make test-integration#TestPackageNuGet` (SQLite) passes, `make
lint-go` reports 0 issues.
- End to end, with `ROOT_URL=https://gitea.example.com/` and a client
container reaching Gitea as `http://<container-name>:3000`, a package
pushed to the registry and `dotnet restore` (SDK 11.0) with that address
as the source:
- 28.4.0: the index returns `https://gitea.example.com/...`, restore
fails with `NU1301`.
- Image built from this branch (`Dockerfile.rootless`): the index
returns `http://<container-name>:3000/...`, the package is restored.

Fixes #40404

AI disclosure: the patch was written with Claude Fable 5.2. The checks
listed above were run against this branch.
2026-11-20 06:03:00 +00:00
Lazizbek Ergashev
629bc3970d fix(web): redirect to the branch after applying a patch (#40450)
After applying a patch in the web editor, Gitea redirected to
`/src/branch/<branch>/__dummy_for_EditRepoFileForm.TreePath(Required)__`,
which is a 404. The patch form only sends that placeholder `tree_path`
to pass form validation, but the handler still used it as the redirect
path. It now redirects to the branch root, like cherry-pick and revert
do.

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

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

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-11-20 05:55:13 +00:00
silverwind
099abf5db4 test: reduce fixture setup work in Go tests (#40423)
Reduce the work Go tests spend on fixture setup, without dropping any
test or covered code. Every fixture repository reset listed and stat'ed
both trees, and many packages copied repositories or created a database
they never use.

- List the fixture repository source tree once per process
- Skip the repository copy in DB-only packages and the database in
settings-only packages
- Drop the unused repository copy and git init from migration tests
- Push LFS files last in `TestGitGeneral`, so LFS hooks don't run on
every later git command
- Link the integration test binary without DWARF

Measured locally on macOS, wall and CPU time:

| | Before | After |
|---|---|---|
| Warm fixture repository reset | 127 ms | 63 ms |
| 30 affected unit packages | 13.6 s, 72 s CPU | 10.0 s, 51 s CPU |
| Migration tests | 29.9 s, 19.1 s CPU | 13.7 s, 8.8 s CPU |
| `TestGitGeneral` | 81 s, 69 s CPU | 62 s, 54 s CPU |
| 46 API integration tests | 41.7 s | 39.0 s |
| Integration test binary relink | 8.7 s, 11.6 s CPU | 3.7 s, 5.7 s CPU
|

Assisted-by: Claude Code:claude-opus-5-5
2026-11-20 02:58:39 +00:00
GiteaBot
860a2d308b [skip ci] Updated translations via Crowdin 2026-11-20 00:32:43 +00:00
wxiaoguang
410c7cc55e refactor: use modern HTML template element and make template-based modal dialog work with morph (#40443)
If an element is being morphed, then it can't contain direct modal
dialog, because "show-modal" moves the dialog into body, then a
duplicate dialog will be morphed into the element.

So, we need to use template-based modal dialog when morphing.

---------

Co-authored-by: silverwind <me@silverwind.io>
2026-11-19 19:13:03 +00:00
bircni
b1c5fedd17 feat(pull): improve merge box, add auto_merge to PR API (#38404)
Rework the merge box after GitHub, fix auto merge edge cases, and add
`auto_merge` to the pull request API.

- Review, checks, mergeability and blocker sections that refresh while
checks run, each rendered from a `pullMergeBoxSection` instead of the
flat info item list.
- Auto merge waits out conflicts, and is canceled on close, WIP, or a
retarget or push by a non-writer.
- Bypassing branch protection needs an explicit checkbox.
- Merging follows the delete branch setting, and the timeline can
restore the deleted branch.
- Unrelated branches get their own status instead of a conflict.
- The merge API answers a merge blocked by an open dependency with 422
instead of 500.

<img width="600" alt="Merge box ready to merge"
src="https://github.com/user-attachments/assets/95dcec16-fba5-446f-81f9-5af1245c887f"
/>
<img width="600" alt="Merge box with review required and checks pending"
src="https://github.com/user-attachments/assets/640ec08e-a964-4520-85e1-5c606dfaf222"
/>

Fixes: https://github.com/go-gitea/gitea/issues/39851
Fixes: https://github.com/go-gitea/gitea/issues/24513

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

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
2026-11-19 18:53:19 +00:00
Mitrahsoft
d4101fda0c enhance: support running and unknown commit status states (#40396)
External CI can report any commit status state, but only the six known
states rendered an icon, so `running` or something like `stage-1` showed
nothing. `running` is now an official state rendered with the same
spinner as Actions, and any other state gets a fallback icon. The
combined status still treats both as pending.

A state longer than the 7-character column (e.g. `in_progress`) caused a
500. It now returns 422, as does an empty state. Widening the column
instead would need a migration, happy to do that in a follow-up if
preferred.

| Before | After |
| --- | --- |
| <img width="1904" height="654" alt="before"
src="https://github.com/user-attachments/assets/811c6a4e-7b5a-4919-8d86-ec586d9f9bfb"
/> | <img width="1919" height="675" alt="after"
src="https://github.com/user-attachments/assets/a088c70d-47fe-40c5-93f7-43d1bacfa77e"
/>|

Fixes: https://github.com/go-gitea/gitea/issues/39608
2026-11-19 11:28:12 +00:00
Lazizbek Ergashev
67463386b1 fix(git): fall back to a plain copy when the git proxy can't splice (#40368)
On old vendor kernels like Synology's 3.10, `splice()` from a TCP socket
fails with `EBADF` instead of `EINVAL`, so Go doesn't fall back to a
normal copy and the git proxy's CONNECT relay dies at once, breaking
every HTTPS clone, mirror and migration.

The relay and the `git://` tunnel now retry with a plain copy when
splice fails with `EBADF` before anything was written, so normal kernels
keep using splice.

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

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

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
2026-11-19 06:17:19 +00:00
GiteaBot
0b3f4c183f [skip ci] Updated translations via Crowdin 2026-11-19 00:34:25 +00:00
silverwind
c376d5d8b1 feat(actions): support cache-mode (#40343)
Support
[`cache-mode`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#cache-mode)
at workflow and job level and forward it in job payloads so runners can
enforce it. As on GitHub, a called workflow may not request more cache
access than its caller allows, otherwise the run fails as an invalid
workflow before it starts.

Enforcement needs the runner change, older runners ignore `cache-mode`.
Both can be deployed in any order.

actionslib: https://gitea.com/gitea/actionslib/pulls/33
runner: https://gitea.com/gitea/runner/pulls/1412

Assisted-by: Claude Code:claude-opus-5-5
2026-11-18 21:33:34 +00:00
silverwind
84c9f8ad76 test(e2e): add more e2e test coverage (#40429)
Add e2e coverage for browser flows that regressed before and had no
browser test.

- Web editor: preview with relative links, diff preview and proposing on
a new branch, catching CRLF in the diff and the commit
- Task lists: toggling in preview and after save with non-ASCII text
- Actions: cancel, rerun and view the earlier attempt
- File navigation: tree, go to file and tag selector on a nested file
with special characters

Assisted-by: Claude Code:claude-opus-5-5
2026-11-18 19:46:05 +00:00