IsBranchExist and IsTagExist now ask got.RefExists instead of git's cat-file
batch. got's exit status is useless here: `got ref -l <unknown>` exits 0 with
no output, and an empty repository reports "HEAD: refs/heads/main" for a branch
that does not exist yet. The wrapper therefore parses the "<name>: <value>"
line and follows symbolic entries with a bounded depth.
IsReferenceExist/IsObjectExist keep the cat-file batch: they answer "is this
object present" for bare and short commit IDs, which got ref cannot, and
`got cat` resolves unknown arguments as paths in HEAD's tree, so it would
report file names as existing objects. That gap is documented, not silent.
Verified: go test ./modules/got ./modules/git (ref_test.go covers both ref
behaviours, the empty repository, and the enclosing-repository escape;
ref_got_test.go covers true/false branches and tags plus a missing got binary).
Full go test ./modules/... ./services/... ./models/... ./routers/... and
make -C cgi check pass.
Assisted-by: splinter:claude-opus-4
Removed the hiddenbox remote and the 192.168.1.148 SSH bare repo from the
docs. Verified: git remote -v lists only origin (kropa) and upstream; branch
main tracks origin/main; tree clean.
Assisted-by: splinter:claude-opus-4
git.hiddenbox.org answers 502, so the second remote is the SSH host used by
casadois. Verified: git push -u origin main (416s, 21850 commits) and
git push -u hiddenbox main both exit 0; git ls-remote shows
1408773068 on both. go build . and make -C cgi check pass.
Assisted-by: splinter:claude-opus-4
Branch listing moved to got, so the migration list and the got integration
notes now say GetBranchNames is covered. Also record the two got behaviours
the code has to guard: `-r` searching upwards on a non-repository path, and
got refusing a repository whose empty directories were lost.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Add BranchCommitID to modules/got and route GetBranchCommitID through it. Cover existing and missing branches and the no-fallback case.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Use got ref -s when the target branch exists and write HEAD atomically for unborn branches, where got ref -s cannot operate. Route git.SetDefaultBranch through the got wrapper and cover both paths plus the no-bypass case in tests.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Add IsEmpty and DefaultBranch to modules/got and route Repository.IsEmpty and GetDefaultBranch through them. Keep SetDefaultBranch on git because got ref -s requires the target branch to exist, which excludes unborn branches. Cover the wiring and the no-fallback behaviour with tests.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Read the ref query parameter, validate it, pass it to got for tree, blob, raw, and log views, and render a no-JavaScript branch/tag bar. Preserve the ref in repository links and cover dev/main switching and traversal rejection in tests.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Add modules/got with a got runner, version check, repository detection, and idempotent bare init. Route bare repository creation from InitRepositoryLocal through got; non-bare temp worktrees keep git. Add [git] GOT_PATH and tests, including an explicit no-fallback test.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Parse eight-slot CDE palette files in addition to key=value themes. Map the active frame, inactive frame, text-area, application-background and front-panel slots, derive readable text and code colours, and add a sample palette plus tests.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Add a Gotea Pages prototype: a pages branch is checked out with got, built with the vendored bb, swapped atomically into a pages root, and served only on a separate host from an allowlist. A post-receive hook installer wires the flow through Gitea delegate hooks. The CGI pages mode isolates the host and contains paths with realpath.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Add a C99/POSIX CGI browser for bare Git-format repositories, using got for every read. Pages are HTML 4.01 Transitional with CSS1, table layout, no JavaScript, and a configurable CDE/Motif palette. The browser supports flat and owner-scoped repository layouts, tree, blob, raw, log, and commit views, and has tests plus generated-page validation.
Assisted-by: OpenCode:DeepSeek-V4.1-Flash
Introduces gitproxy module which spawns a small forward proxy as scanner
for git calls
Replaces hostmatcher with matchlist which supports port rules
Deprecates ALLOWED_DOMAINS/BLOCKED_DOMAINS and ALLOW_LOCALNETWORKS
settings in migration in favor of full names we have in security
configs.
Removes `external` preset in favor of lax/strict modes, strict mode
requiring explicit ports if they aren't standard http/s ones.
Breaking changes:
- `external` preset no longer works as deny rule. To enforce that, use
`strict` mode and allow ranges to connect to
- Wildcards are no longer accepted in IP addresses
- `*` is no longer allowed as entry in lists
- domain rules now use curl like syntax `*.example.com` matching
subdomains but not `example.com`, `example.com` matching itself and all
subdomains. `example.*` is not a valid rule
- In the default `lax` mode, `[security] ALLOWED_HOST_LIST` no longer
restricts public hosts, set `EGRESS_MODE = strict` to keep an exclusive
list. A startup warning flags this
- Invalid list entries are logged at startup, invalid
`BLOCKED_HOST_LIST`/`BLOCKED_DOMAINS` entries stop it
Docs: https://gitea.com/gitea/docs/pulls/557
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Few small tweaks that should improve the quality:
- Make agents read `docs` folder
- Shorter comments, shorter PR descriptions
- Modern Go features
Signed-off-by: silverwind <me@silverwind.io>
Further refinements to AGENTS.md:
- consolidate some points
- add point about locales
- rewrite some points for clarity and size
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
Adds browser-level coverage for the pull request merge box, which
currently had no tests. Exercises the full merge flow: open the PR,
expand the merge form, submit, and assert the merged state.
Extracted from https://github.com/go-gitea/gitea/pull/36759.
Also updated AGENTS.md with instructions for e2e tests.
---------
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
Change from Co-Authored by trailer to Assisted-By and explicitly forbid
LLMs from signing off on commits.
---------
Signed-off-by: bircni <bircni@icloud.com>
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
The modernc SQLite driver (default since
https://github.com/go-gitea/gitea/pull/37562) returns `SQLITE_BUSY` once
the busy timeout is reached, unlike mattn which waited indefinitely.
`TestResourceIndex` fires many concurrent `NewIssue` writers, but SQLite
serializes all writers, so they queue on a single `BEGIN IMMEDIATE`
write lock. Under `-race` (modernc is much slower) the goroutines at the
back of the queue exceeded the hardcoded 5s test timeout, producing
`database is locked (5) (SQLITE_BUSY)`.
Changes:
- Reduce the concurrent inserts from 25 to 10. Since SQLite serializes
writers, the extra goroutines only deepen the busy-lock queue without
adding coverage. 10 still exercises concurrent index allocation while
cutting the test's `-race` runtime ~3x (2.76s to 0.86s locally).
- Share the busy-timeout constant: export `DefaultSQLiteBusyTimeout`
(20s, the production default) and reference it from the test engine
instead of the hardcoded `5000`.
Observed flake:
https://github.com/go-gitea/gitea/actions/runs/26394082930/job/77690496092
---
This PR was written with the help of Claude Opus 4.7
---------
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Add two rules to `AGENTS.md` for recurring issues.
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
## Summary
- Enforce **Conventional Commits** on PR titles (PRs are squash-merged,
so the PR title becomes the final commit message).
- Add a local `make lint-pr-title` target so contributors can validate
titles before pushing.
## Why
We squash-merge PRs, which means the final repository history is largely
shaped by **PR titles**. Enforcing a consistent Conventional Commits
format makes:
- **Release notes & changelogs easier to generate** (types like `feat` /
`fix` can be grouped automatically).
- **History easier to scan** (uniform structure, optional scopes,
explicit breaking changes via `!`).
- **Automation more reliable** (future tooling can infer category and
scope from the title).
## PR title format
```text
type(scope)!: subject
type: one of build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test
scope: optional (e.g. web, api, actions, repo, …)
!: optional, indicates a breaking change
subject: short, imperative, no trailing period
```
## Examples
```text
feat(web): add dark mode toggle
fix(api): avoid panic when repo is missing
chore(ci): lint PR titles with commitlint
refactor(templates): reduce duplication in repo list rendering
feat!: remove legacy OAuth endpoint
```
## Local testing
```text
make deps-frontend
make lint-pr-title PR_TITLE="feat(web): add dark mode toggle"
```
---------
Signed-off-by: Nicolas <bircni@icloud.com>
Co-authored-by: nb <nb@users.noreply.local>
Co-authored-by: GPT-5.2 <gpt-5.2@openai.com>
`make test-sqlite#TestName` was much too slow, suggest `go test`. Also
added a similar instruction for js tests.
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: Nicolas <bircni@icloud.com>
Adds points to `AGENTS.md` how to run single tests because AIs get these
wrong too often (either they trigger the whole suite or run into other
errors).
---
This PR was written with the help of Claude Opus 4.7
---------
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Add and modify more instruction for common problems in this codebase and
made the force-push instruction more strict.
---------
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
1. Remove header line, useless context bloat
2. Reword all "before commiting" lines because some people may not be
using the agent to commit, only to write changes.