Commit Graph
5436 Commits
Author SHA1 Message Date
19ae1f842b refactor: fix go vet errors related to composite literals (#39341)
Fix these `go vet` errors which I stumbled upon because AI likes to run
`go vet` standalone and `go vet` does not understand `//nolint` like
golangci does, so it produced confusing output.

Co-authored-by: bircni <bircni@icloud.com>
2026-09-24 09:17:25 +00:00
72243bead7 fix(indexer): index full file paths and real offsets in bleve (#39405)
The bleve path token filter added in
https://github.com/go-gitea/gitea/pull/32210 never generated the full
path of a file, so searching a file by its path (e.g. `potato/ham`)
found nothing. It also gave the path tokens made-up offsets instead of
their position in the path.

The filter is replaced by a tokenizer that emits the raw path suffixes
starting at each segment and word (`potato/ham.md`, `ham.md`). Paths
below the root now match too, as do names containing `-` or spaces and
dotfiles. An exact file name also ranks above files inside a directory
with the same name.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-24 07:57:42 +00:00
8b46a956d8 perf(references): scan only the keyword window before a reference (#39396)
Fixes https://github.com/go-gitea/gitea/issues/39395

`findActionKeywords` ran the close and reopen keyword patterns over all
content before each reference, making `FindAllIssueReferences` quadratic
on comments and commit messages. The patterns are anchored at the
reference, so only the last few bytes can match. Scan only that window,
sized from the longest keyword with room for `(?i)` matching wider runes
like `ſ` for `s`.

`"#1 "` repeated 4000 times: 2.04 s before, 16 ms after.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-24 07:12:02 +00:00
wxiaoguangandGitHub f14cedc4fa refactor: "install" page (#39400)
1. remove useless options
2. set AppDataPath instead of repo root path
3. make "disable self-registration" default enabled
4. avoid writing corrupted ini file
5. avoid auto-sign-in the existing admin user
2026-09-23 23:14:31 +00:00
191287d8be fix(repo): commit page fails to render unsigned commits with a different committer (#39381)
Since #39229 the commit page header dereferences
`.Verification.CommittingUser` when the committer is not the author.
`Verification` is `nil` for unsigned commits (see `repo.Diff`), so
opening such a commit — a rebased or cherry-picked one, for example —
logs a template error and the page comes out truncated:

```
Render failed: failed to render template: repo/commit_page, error: template error: builtin(bindata):repo/commit_page:138:22 : executing "repo/commit_page" at <.Verification.CommittingUser>: nil pointer evaluating interface {}.CommittingUser
```

This guards the access and adds an integration test that creates a
commit with distinct author and committer identities and checks the page
renders completely (the status stays 200 on a mid-render failure, so the
test looks at the body).

_The fix was worked out with help from an AI assistant; I reviewed and
tested it myself._

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-23 14:34:19 +00:00
wxiaoguangandGitHub 7637b1b816 chore: refactor StaticRootPath (#39384)
When need to use some settings in testing code, always call `SetupGiteaTestEnv`
2026-09-22 22:49:36 +08:00
cdf786ce92 fix: pass merge commit messages to git via stdin (#39269)
`git commit --message=` passes the merge message as a single argument,
which Linux caps at 128 KiB and Windows at 32 KiB for the whole command
line. Long messages failed with `argument list too long` and the merge
box toast showed the raw HTML 500 page.

Pass the message via `--file=-` on stdin instead, and answer
fetch-action requests with JSON on server errors so the toast shows the
error text. Limits merge commit messages to 512KB which could be
extended or made configurable later.

Fixes: https://github.com/go-gitea/gitea/issues/39261
Fixes: https://github.com/go-gitea/gitea/issues/30276
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-19 13:04:53 +00:00
cc34c26172 fix(migrations): preserve SHA-256 pull request commit IDs (#39343)
* Fixes #39339

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-19 12:41:41 +00:00
b27e7d0289 enhance: improve issue-pattern capture groups and support both internal&external trackers enabled (#39354)
* Fix #39351
* Fix #17621
* Fix #34881

By the way, fix error handling bugs in `updateRepoUnits`

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-18 08:53:45 -07:00
silverwindandGitHub 85eaf5c71c refactor(api): convert bot accounts through the admin user edit endpoint (#39355)
Follow-up to https://github.com/go-gitea/gitea/pull/38966. Replaces the
unreleased `POST /admin/users/{username}/convert-type` endpoint with a
`type` field on `PATCH /admin/users/{username}`.
2026-09-18 17:11:56 +02:00
3bec08f998 feat: manage bot accounts from the admin UI, API and CLI (#38966)
Adds first-class bot accounts (`UserTypeBot`): local, password-less
users for automation that authenticate only with access tokens.

1. Admin UI: create bots, filter users by type, manage a bot's access
tokens, convert between user and bot
2. API: `POST /admin/users/{username}/convert-type`, and user objects
gain a GitHub-compatible `type` (`User`, `Organization`, `Bot`)
3. CLI: `gitea admin user change-type`, `--user-type` accepts `User` or
`Bot` case-insensitively
4. Converting keeps the password, 2FA, OAuth2 grants and access tokens,
and since sign-in rejects bots, converting back restores the account.
Only local, non-admin accounts can be converted, and conversions are
audited
5. Session, reverse proxy, SSPI, external source and password reset
sign-in reject non-individual users, so a bot never gets an interactive
session
6. Bots receive no notifications or emails

Co-authored-by: Nicolas <bircni@icloud.com>
Co-authored-by: joestump <joe@joestump.net>
Co-authored-by: Joe Stump <joe@stu.mp>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-09-18 12:43:36 +00:00
silverwindandGitHub db7dbd5a6b test: stop tests from writing into ~/.ssh (#39348) 2026-09-18 17:07:45 +08:00
4892a55e29 enhance: allow attribute-less MathML elements and complete the Core allowlist (#39337)
Follow-up to https://github.com/go-gitea/gitea/pull/38034.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-17 13:18:33 +00:00
b2e11ddb37 fix: add default timeout and handle errors for HaveIBeenPwned API (#39316)
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-16 20:41:57 +02:00
7ebb2caa9e fix(user): unify email validation for registration and settings (#39304)
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-16 17:34:41 +00:00
c6c671e113 refactor: replace Azure Blob SDK with a REST client (#39315)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-16 17:06:00 +02:00
c04802b6b3 enhance: support ETag on streamed repository archives, support If-None-Match: * (#39289)
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 5) <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-16 12:30:22 +02:00
812191c0f9 fix: classify git failures on stderr, restrict migration failure detail (#39010)
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-15 10:59:34 +02:00
c0ceea2f8f chore: fix various problems (#39298)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-09-14 22:15:21 +02:00
85cbf477e5 fix: correct stdErr match in isErrBlameNotFoundOrNotEnoughLines (#39309)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-14 14:59:18 +00:00
13033827b1 chore(deps): update actionslib to v1.0.0 (#39295)
Co-authored-by: bircni <bircni@icloud.com>
2026-09-14 16:29:31 +02:00
1e13badb39 enhance: truncate but show long lines in diffs (#39279)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-12 11:56:25 +00:00
da37b7916b feat: Add audit logging (#38189)
Co-authored-by: bircni <bircni@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-12 08:15:23 +00:00
81dee529ed enhance: improve e-mail templates (#38396)
Co-authored-by: bircni <bircni@icloud.com>
2026-09-09 17:58:27 +00:00
459fc13783 enhance(packages): implement npm single-version API and add per-version repository (#39267)
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-09-08 18:25:29 +00:00
wxiaoguangandGitHub 45a78bbc8e refactor: npm route handlers (#39275) 2026-09-08 15:15:40 +00:00
wxiaoguangandGitHub 3176f37887 fix: avoid nil panic and refactor some trivial problems (#39251) 2026-09-06 09:49:27 +00:00
87d5497da0 enhance: improve commit page header (#39229)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-06 11:27:04 +02:00
wxiaoguangandGitHub 3bd7ea4c9f refactor: GetDiffShortStat and fix panic caused by inconsistent "changed file number" (#39248) 2026-09-06 05:20:42 +00:00
bde1af541c enhance(web): show attachment URL and UUID in dropzone preview (#39203)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-05 10:01:27 +00:00
eb501f6b19 enhance: move window.config to JSON, improve CSP format (#39236)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-05 08:50:43 +00:00
efa69e7230 fix: restore missing blob file when re-publishing a package (#39239)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-05 10:33:36 +02:00
2d3ad4a530 enhance: Improve validation errors for secrets/variables (#39221)
Signed-off-by: Ross Golder <ross@golder.org>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-04 00:28:58 +00:00
bcd913a4e2 fix(httplib): prevent leaking localhost:3000 in public links (#39217)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-02 19:32:33 +00:00
fc9800b383 fix(setting): honor bare -1 for timeout settings (#39181)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-31 19:48:59 +00:00
wxiaoguangandGitHub be3a6d1647 fix: charset lookup (#39187) 2026-08-31 11:48:52 +00:00
7c36ae7668 fix(git): keep IPv6 brackets in submodule web links (#39186)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-31 11:29:18 +00:00
eea03676d3 fix(process): reap entire process group on cmd.Cancel (#39143)
Signed-off-by: Royce Remer <royceremer@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-29 19:54:07 +00:00
60326ca03d refactor(automerge): fix error handling, populate recent automerge tasks on restart (#39001)
* Refactor "automerge" related code, clarify many details (including "unique queue item", start check by pull head or commit)
* Fix automerge queue handler's error handling, clarify error messages
* Populate recent automerge tasks on restart to restore the previous aborted automerge tasks

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-28 14:17:01 -07:00
silverwindandGitHub 1652dfe62a chore(frontend): avoid loading CSS twice in vite dev mode (#39160) 2026-08-28 22:57:08 +02:00
silverwindandGitHub 66c672d0b7 refactor: drop two unmaintained dependencies, rename the byte size helpers (#39083) 2026-08-27 15:31:20 +00:00
3b6ce586a7 fix(actions): keep step-level continue-on-error expressions unevaluated (#39141)
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
2026-08-27 05:46:46 +00:00
646ea0f253 feat: add deploy tokens (#37306)
Deploy keys only work over SSH. A deploy token is their counterpart for HTTPS: a repository scoped credential, used as the password of a Git request, with read or read and write access. It covers Git operations and LFS, and can be regenerated in place.

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude Mythos <noreply@anthropic.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-26 19:32:44 +00:00
silverwindandGitHub 3c4d5a6a5c chore: raise minimum git version to 2.25 (#39131) 2026-08-26 18:35:44 +00:00
3005efa88d fix: recognize linguist language aliases (#39135)
Co-authored-by: loveulvu <ax9inl@google.com>
2026-08-26 17:24:07 +02:00
e21c37703e fix(repo): centralize repository-scoped authorization (#39063)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-26 20:12:53 +08:00
1680ac24e6 chore: anchor golangci exclusion paths to directories (#39116)
Co-authored-by: Claude (Opus 5) <noreply@anthropic.com>
2026-08-25 16:36:45 +00:00
c8660364d9 fix(asymkey): do not verify OpenPGP signatures with an SSH instance key, require git 2.18 (#39073)
With SIGNING_FORMAT = ssh the OpenPGP verification path builds its
GPGSettings from the instance signing key but leaves the format empty,
so it runs `gpg -a --export` on an SSH public key path. Depending on the
local gpg setup that either exports nothing, so an OpenPGP signed commit
reports gpg.error.generate_hash instead of a missing key, or it fails
outright and logs an export error for every such commit.

Both guards are needed. The first covers SIGNING_KEY set to a path with
SIGNING_FORMAT=ssh; the second covers the shipped default
SIGNING_KEY=default, where the format comes from git's own gpg.format
and never gets reconciled with the hardcoded "openpgp". Drop either one
and a working config goes back to broken.

Also raise minimum git version to 2.18 which was already required before this change.

Fixes: https://github.com/go-gitea/gitea/issues/37452
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-08-25 12:02:31 +00:00
Artem LytkinandGitHub 2a17cf7ded fix(git): parse co-author trailers that are not RFC 5322 addresses (#39076)
Bot co-authors like `dependabot[bot]` render as one long string with the
email inside the name, and never get truncated, so they overflow the
column.

Co-author idents are parsed with `net/mail`, but a git ident isn't an
email address. `mail.ParseAddress` rejects the whole value when the name
holds characters RFC 5322 reserves, like a `[bot]` suffix or a comma, so
the error branch keeps the raw trailer as the display name and throws
the address away. No address means no `mailto:` link, and the anchor is
what `.avatar-stack-names` truncates.

So parse the angle-addr ourselves when `net/mail` won't take it.
Splitting on the last `<` is safe because git strips angle brackets from
idents. The bare-name branch gets the class too.

Fixes https://github.com/go-gitea/gitea/issues/38949
2026-08-24 19:06:30 +00:00
silverwindandGitHub 32728fc581 chore: misc go 1.27 tweaks (#39069)
Follow-up to https://github.com/go-gitea/gitea/pull/39068, which
disabled `modernize` entirely.

- re-enable `modernize`, with only the new `embedlit` rule disabled. It
flattens embedded struct literals across ~145 files, and orphans imports
in 6 of them that the fixer does not remove
- apply the rest of the suite: `errors.AsType`, `reflect.TypeAssert`,
`strings.Cut`, and dropping the legacy import comment
- use the new stdlib `uuid` package, `github.com/google/uuid` becomes
indirect
- use `strings.CutLast` in place of manual `LastIndex` slicing in label
scopes, email domains and the diff tree list
- take the header lint skip dirs from the `go.mod` `ignore` directive
and skip dot-directories, instead of hardcoding the list

Assisted-by: Claude Code:claude-opus-5
2026-08-24 18:26:10 +00:00