pat-s
63a80bf2b9
feat: use XORM EngineGroup instead of single Engine connection ( #7212 )
...
Resolves #7207
Add new configuration to make XORM work with a main and replicas database instances. The follow configuration parameters were added:
- `HOST_PRIMARY`
- `HOST_REPLICAS`
- `LOAD_BALANCE_POLICY`. Options:
- `"WeightRandom"` -> `xorm.WeightRandomPolicy`
- `"WeightRoundRobin` -> `WeightRoundRobinPolicy`
- `"LeastCon"` -> `LeastConnPolicy`
- `"RoundRobin"` -> `xorm.RoundRobinPolicy()`
- default: `xorm.RandomPolicy()`
- `LOAD_BALANCE_WEIGHTS`
Co-authored-by: pat-s <patrick.schratz@gmail.com@>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7212
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
2025-03-30 11:34:02 +00:00
Gusted
2457f5ff22
chore: branding import path ( #7337 )
...
- Massive replacement of changing `code.gitea.io/gitea` to `forgejo.org`.
- Resolves forgejo/discussions#258
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7337
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-03-27 19:40:14 +00:00
TheFox0x7
4de909747b
Add testifylint to lint checks ( #4535 )
...
go-require lint is ignored for now
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
2024-07-30 19:41:10 +00:00
Lunny Xiao
dd30d9d5c0
Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods ( #28220 )
...
The function `GetByBean` has an obvious defect that when the fields are
empty values, it will be ignored. Then users will get a wrong result
which is possibly used to make a security problem.
To avoid the possibility, this PR removed function `GetByBean` and all
references.
And some new generic functions have been introduced to be used.
The recommand usage like below.
```go
// if query an object according id
obj, err := db.GetByID[Object](ctx, id)
// query with other conditions
obj, err := db.Get[Object](ctx, builder.Eq{"a": a, "b":b})
```
2023-12-07 15:27:36 +08:00
wxiaoguang
e422342eeb
Allow adding new files to an empty repo ( #24164 )
...

2023-04-19 21:40:42 +08:00
oliverpool
bb2783860b
fix calReleaseNumCommitsBehind ( #24148 )
...
`repoCtx.CommitsCount` is not reliably the commit count of the default
branch (Repository.GetCommitsCount depends on what is currently
displayed).
For instance on the releases page the commit count is correct:
https://codeberg.org/Codeberg/pages-server/releases

However it is not on the single page:
https://codeberg.org/Codeberg/pages-server/releases/tag/v4.6.2

This PR fixes this by removing a "fast branch" which was using this
field (I think this field should be removed, since it is a bit
unpredictable - but this would mean a larger refactoring PR).
_contributed in the context of @forgejo_
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-04-18 21:11:17 +02:00
Nick
52e24167e5
Test renderReadmeFile ( #23185 )
...
Add test coverage to the important features of
[`routers.web.repo.renderReadmeFile`](067b0c2664/routers/web/repo/view.go (L273)
);
namely that:
- it can handle looking in docs/, .gitea/, and .github/
- it can handle choosing between multiple competing READMEs
- it prefers the localized README to the markdown README to the
plaintext README
- it can handle broken symlinks when processing all the options
- it uses the name of the symlink, not the name of the target of the
symlink
2023-03-09 09:24:23 +08:00
Kyle D
2b3f12f6fd
Use beforeCommit instead of baseCommit ( #22949 )
...
Replaces: https://github.com/go-gitea/gitea/pull/22947
Fixes https://github.com/go-gitea/gitea/issues/22946
Probably related to https://github.com/go-gitea/gitea/issues/19530
Basically, many of the diffs were broken because they were comparing to
the base commit, where a 3-dot diff should be comparing to the [last
common
ancestor](https://matthew-brett.github.io/pydagogue/git_diff_dots.html ).
This should have an integration test so that we don’t run into this
issue again.
---------
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2023-02-20 11:56:07 +08:00
Nick
a2779def36
Test views of LFS files ( #22196 )
2022-12-23 07:41:56 +08:00
Lunny Xiao
36a2d2f919
Add a simple test for external renderer ( #20033 )
...
Fix #16402
2022-12-12 20:45:21 +08:00
flynnnnnnnnnn
e81ccc406b
Implement FSFE REUSE for golang files ( #21840 )
...
Change all license headers to comply with REUSE specification.
Fix #16132
Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2022-11-27 18:20:29 +00:00
Lunny Xiao
9a70a12a34
Merge db.Iterate and IterateObjects ( #21641 )
...
These two functions are similiar, merge them.
2022-10-31 23:51:14 +08:00