delvh
0ebb45cfe7
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) ( #21551 )
...
Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago
wxiaoguang
dcd9fc7ee8
Refactor git command arguments and make all arguments to be safe to be used ( #21535 )
...
Follow #21464
Make all git command arguments strictly safe. Most changes are one-to-one replacing, keep all existing logic.
2 years ago
Wim
cb50375e2b
Add more linters to improve code readability ( #19989 )
...
Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability
- nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
- unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions
- wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements.
- notlintlint - Reports ill-formed or insufficient nolint directives
- stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent
- excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003 ) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005 )
3 years ago
Lunny Xiao
27ba86d283
move agit dependcy ( #19998 )
3 years ago
Lunny Xiao
1a9821f57a
Move issues related files into models/issues ( #19931 )
...
* Move access and repo permission to models/perm/access
* fix test
* fix git test
* Move functions sequence
* Some improvements per @KN4CK3R and @delvh
* Move issues related code to models/issues
* Move some issues related sub package
* Merge
* Fix test
* Fix test
* Fix test
* Fix test
* Rename some files
3 years ago
zeripath
d002e3da00
Fix spelling mistake in ProcReceive ( #19853 )
...
There was a spelling mistake in the ProcReceive handler. This PR fixes
this.
3 years ago
6543
06e4687cec
more context for models ( #19511 )
...
make more usage of context, to have more db transaction in one session
(make diff of #9307 smaller)
3 years ago
wxiaoguang
124b072f0b
Remove `git.Command.Run` and `git.Command.RunInDir*` ( #19280 )
...
Follows #19266 , #8553 , Close #18553 , now there are only three `Run..(&RunOpts{})` functions.
* before: `stdout, err := RunInDir(path)`
* now: `stdout, _, err := RunStdString(&git.RunOpts{Dir:path})`
3 years ago
6543
3043eb36bf
Delete old git.NewCommand() and use it as git.NewCommandContext() ( #18552 )
3 years ago
zeripath
5cb0c9aa0d
Propagate context and ensure git commands run in request context ( #17868 )
...
This PR continues the work in #17125 by progressively ensuring that git
commands run within the request context.
This now means that the if there is a git repo already open in the context it will be used instead of reopening it.
Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago
luzpaz
8c647bf0f6
Fix various typos ( #18219 )
...
Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby,te,unknwon`
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago
Lunny Xiao
a666829a37
Move user related model into models/user ( #17781 )
...
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
3 years ago
a1012112796
358555f72c
Return correct error response for agit force-push ( #16989 )
...
fix a samll nit for agit `force-push` error response
Signed-off-by: a1012112796 <1012112796@qq.com>
3 years ago
Lunny Xiao
74d75eb69c
Fix spelling of HookProcReceiveResult ( #16690 )
3 years ago
a1012112796
3705168837
Add agit flow support in gitea ( #14295 )
...
* feature: add agit flow support
ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/
example:
```Bash
git checkout -b test
echo "test" >> README.md
git commit -m "test"
git push origin HEAD:refs/for/master -o topic=test
```
Signed-off-by: a1012112796 <1012112796@qq.com>
* fix lint
* simplify code add fix some nits
* update merge help message
* Apply suggestions from code review. Thanks @jiangxin
* add forced-update message
* fix lint
* splite writePktLine
* add refs/for/<target-branch>/<topic-branch> support also
* Add test code add fix api
* fix lint
* fix test
* skip test if git version < 2.29
* try test with git 2.30.1
* fix permission check bug
* fix some nit
* logic implify and test code update
* fix bug
* apply suggestions from code review
* prepare for merge
Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix permission check bug
- test code update
- apply suggestions from code review @zeripath
Signed-off-by: a1012112796 <1012112796@qq.com>
* fix bug when target branch isn't exist
* prevent some special push and fix some nits
* fix lint
* try splite
* Apply suggestions from code review
- fix permission check
- handle user rename
* fix version negotiation
* remane
* fix template
* handle empty repo
* ui: fix branch link under the title
* fix nits
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago