You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/modules
zeripath 198342efe4
Add setting to disable the git apply step in test patch (#22130) (#22170)
Backport #22130

For a long time Gitea has tested PR patches using a git apply --check
method, and in fact prior to the introduction of a read-tree assisted
three-way merge in #18004, this was the only way of checking patches.

Since #18004, the git apply --check method has been a fallback method,
only used when the read-tree three-way merge method has detected a
conflict. The read-tree assisted three-way merge method is much faster
and less resource intensive method of detecting conflicts. #18004 kept
the git apply method around because it was thought possible that this
fallback might be able to rectify conflicts that the read-tree three-way
merge detected. I am not certain if this could ever be the case.

Given the uncertainty here and the now relative stability of the
read-tree method - this PR makes using this fallback optional but
enables it by default. A `log.Critical` has been added which will alert
if the `git apply --check` method was successful at checking a PR that
`read-tree` failed on.

The hope is that none of these log.Critical messages will be found and
there will be no significant difference in conflict detection. Thus we
will be able to remove the git apply fallback in future, and/or improve
the read-tree three-way merge method to catch any conflicts that git
apply method might have been able to fix.

An additional benefit for anyone who disables the check method is that
patch checking should be significantly less resource intensive and much
quicker.

(See
https://github.com/go-gitea/gitea/issues/22083\#issuecomment-1347961737)

Ref #22083

Signed-off-by: Andrew Thornton <art27@cantab.net>

<!--

Please check the following:

1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)

-->

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2 years ago
..
activitypub Fix dashboard ignored system setting cache (#21621) (#21759) 2 years ago
analyze Simplify `IsVendor` (#19626) 3 years ago
auth Remove legacy `+build:` constraint (#19582) 3 years ago
avatar Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
base Add generic set type (#21408) 2 years ago
cache Fix dashboard ignored system setting cache (#21621) (#21759) 2 years ago
charset Ensure that plain files are rendered correctly even when containing ambiguous characters (#22017) (#22160) 2 years ago
container Add generic set type (#21408) 2 years ago
context Add support for HEAD requests in Maven registry (#21834) (#21929) 2 years ago
convert Use GhostUser if needed for TrackedTimes (#22021) (#22029) 2 years ago
csv Go 1.19 format (#20758) 3 years ago
doctor Prevent dangling user redirects (#21856) (#21858) 2 years ago
emoji Go 1.19 format (#20758) 3 years ago
eventsource Move some files into models' sub packages (#20262) 3 years ago
generate Use base32 for 2FA scratch token (#18384) 3 years ago
git Handle empty author names (#21902) (#22027) 2 years ago
gitgraph Refactor git command arguments and make all arguments to be safe to be used (#21535) 2 years ago
graceful Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
hcaptcha
highlight Upgrade chroma to v2.3.0 (#21259) 2 years ago
hostmatcher Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
httpcache Add Cache-Control header to html and api responses, add no-transform (#20432) 3 years ago
httplib refactor httplib (#18338) 3 years ago
indexer Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
issue/template Use path not filepath in template filenames (#21993) (#22022) 2 years ago
json Refactor legacy `unknwon/com` package, improve golangci lint (#19284) 3 years ago
lfs Removed some vestigial code related to Range bounds checks (#20312) 3 years ago
log Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
markup Support comma-delimited string as labels in issue template (#21831) (#21873) 2 years ago
mcaptcha Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
metrics Move some files into models' sub packages (#20262) 3 years ago
migration Add more checks in migration code (#21011) 3 years ago
mirror Implement sync push mirror on commit (#19411) 3 years ago
nosql fix broken insecureskipverify handling in rediss connection uris (#20967) 3 years ago
notification Decouple HookTask from Repository (#17940) 2 years ago
options Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
packages Normalize NuGet package version on upload (#22186) (#22200) 2 years ago
paginator Remove unnecessary misspell ignore pattern (#21475) 2 years ago
password
pprof Go 1.19 format (#20758) 3 years ago
private Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
process Add more linters to improve code readability (#19989) 3 years ago
proxy Return nil proxy function if proxy not enabled (#16742) 4 years ago
proxyprotocol Support Proxy protocol (#12527) 3 years ago
public Add generic set type (#21408) 2 years ago
queue Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
recaptcha Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
references Remove unnecessary misspell ignore pattern (#21475) 2 years ago
regexplru Custom regexp external issues (#17624) 3 years ago
repository Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
secret Use `CryptoRandomBytes` instead of `CryptoRandomString` (#18439) 3 years ago
session format with gofumpt (#18184) 3 years ago
setting Add setting to disable the git apply step in test patch (#22130) (#22170) 2 years ago
sitemap Add sitemap support (#18407) 3 years ago
ssh Support Proxy protocol (#12527) 3 years ago
storage Local storage should not store files as executable (#22162) (#22163) 2 years ago
structs Support comma-delimited string as labels in issue template (#21831) (#21873) 2 years ago
svg Remove legacy `+build:` constraint (#19582) 3 years ago
sync Add generic set type (#21408) 2 years ago
system Fix dashboard ignored system setting cache (#21621) (#21759) 2 years ago
templates Fix vertical align of committer avatar rendered by email address (#21884) (#21918) 2 years ago
test Refactor AssertExistsAndLoadBean to use generics (#20797) 3 years ago
timeutil Check for zero time instant in TimeStamp.IsZero() (#22171) (#22172) 2 years ago
translation Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
typesniffer Rework raw file http header logic (#20484) 3 years ago
updatechecker Add system setting table with cache and also add cache supports for user setting (#18058) 2 years ago
upload Simplify parameter types (#18006) 3 years ago
uri Prevent NPE if gitea uploader fails to open url (#18080) 3 years ago
user
util Make every not exist error unwrappable to a fs.ErrNotExist (#20891) 2 years ago
validation Add more checks in migration code (#21011) 3 years ago
watcher Share HTML template renderers and create a watcher framework (#20218) 3 years ago
web refactor webhook *NewPost (#20729) 3 years ago