mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-03 15:28:55 +00:00
075ff8f516
Speeds up two slow git paths. Results match `main` apart from the `log.follow` fix. - Activity top authors skip `--numstat` and an unused `rev-list --count`, they only need names and emails - Subdirectory listings pass only the directory as pathspec, which already matches all its entries - Directory listings pass `--no-follow` to `git log`, a configured `log.follow` disabled parent rewriting and gave wrong last commits | Benchmark | main | PR | Change | |---|--:|--:|--:| | Top authors, gitea, 1 month | 632 ms | 21 ms | -97% | | Top authors, gitea, 1 year | 3216 ms | 68 ms | -98% | | Top authors, tea | 62 ms | 12 ms | -80% | | Listing, git `Documentation/technical` | 189 ms | 91 ms | -52% | | Listing, gitea `options/license` | 329 ms | 208 ms | -37% | | Listing, gitea `templates/repo` | 294 ms | 223 ms | -24% | Tested with unit and sqlite integration tests in default and `gogit` builds on git 2.25 and 2.56, and by comparing listing results and cache writes with `main` on randomized histories and the gitea, tea and git repos. Benchmarks are medians of 8 interleaved macOS runs.
23 lines
2.6 KiB
Markdown
23 lines
2.6 KiB
Markdown
- Never assume, verify before claiming
|
|
- List development targets with `make help`
|
|
- Read relevant developer documentation in the `docs` folder
|
|
- PR descriptions: minimal, only what and why, no task or file listings. Include screenshots for UI changes, before and after when modifying existing UI. Aim for less than 1000 characters
|
|
- Reference issues and PRs by full URL, not by number
|
|
- Use Conventional Commits for commit messages and PR titles, plus Gitea's `enhance` type for user-facing enhancements
|
|
- Add an `Assisted-by: AGENT_NAME:MODEL_VERSION` trailer to commit messages, never `Co-Authored-By` or `Signed-off-by`
|
|
- Attribute agent authorship on one trailing line in issue and PR comments, never as a PR description section
|
|
- Never rewrite git history unless asked, update PRs with new commits and normal push
|
|
- Comments: write almost none, short and preferably same-line, explaining why for a future reader. Never narrate code, the change or the prompt. Preserve existing ones that still apply. If you need to write a paragraph-long comment, rethink your implementation, it is likely too complicated
|
|
- Add the current year to copyright headers of new `.go` files
|
|
- In `options/locale`, only edit `locale_en-US.json`, other locales are synced automatically
|
|
- In TS, use `!` instead of `?.`/`??` when a value always exists
|
|
- In Go, prefer to use modern language features wherever possible
|
|
- In Go, function-name prefixes in errors like `fmt.Errorf("Foo: %w", err)` must always name the function they are in
|
|
- Write sizes as multiplications like `64 * 1024`, not bit shifts like `64 << 10`
|
|
- Prefer `tw-*` utilities over inline `style` and `flex-*` helpers over per-child `tw-ml-*`/`tw-mr-*` margins, falling back to `tw-*` where specificity requires `!important`
|
|
- Run `make fmt` after `.go` edits, `make tidy` after `go.mod` edits, `make generate-swagger` after API changes, and lint what changed with `make lint-go`, `lint-js`, `lint-css` or `lint-templates`
|
|
- Fix the cause rather than disabling a linter or weakening a test. Where unavoidable, use the narrowest scope with a trailing comment giving the reason
|
|
- Run single tests with `go test -run '^TestName$' ./modulepath/` for Go, `pnpm exec vitest <path-filter>` for TS and `GITEA_TEST_E2E_FLAGS='<filepath>' make test-e2e` for e2e
|
|
- Write the fewest, fastest tests covering the behavior, extending an existing one where possible. Prefer unit tests where logic is testable in isolation
|
|
- Aim for sub-2s per integration test and sub-4s per e2e test. Wait on a deterministic condition rather than `sleep`, and prefer semantic locators in e2e tests
|