forgejo/modules
wxiaoguang b877504b03
Refactor git.Command.Run*, introduce RunWithContextString and RunWithContextBytes ()
This follows 
* https://github.com/go-gitea/gitea/issues/18553

Introduce `RunWithContextString` and `RunWithContextBytes` to help the refactoring. Add related unit tests. They keep the same behavior to save stderr into err.Error() as `RunInXxx` before.

Remove `RunInDirTimeoutPipeline` `RunInDirTimeoutFullPipeline` `RunInDirTimeout` `RunInDirTimeoutEnv`  `RunInDirPipeline`  `RunInDirFullPipeline`  `RunTimeout`, `RunInDirTimeoutEnvPipeline`, `RunInDirTimeoutEnvFullPipeline`, `RunInDirTimeoutEnvFullPipelineFunc`.

Then remaining `RunInDir` `RunInDirBytes` `RunInDirWithEnv` can be easily refactored in next PR with a simple search & replace:
* before: `stdout, err := RunInDir(path)`
* next: `stdout, _, err := RunWithContextString(&git.RunContext{Dir:path})`

Other changes:
1. When `timeout <= 0`, use default. Because `timeout==0` is meaningless and could cause bugs. And now many functions becomes more simple, eg: `GitGcRepos` 9 lines to 1 line. `Fsck` 6 lines to 1 line.
2. Only set defaultCommandExecutionTimeout when the option `setting.Git.Timeout.Default > 0`
2022-03-31 13:56:22 +02:00
..
activitypub
analyze
appstate
auth
avatar
base
cache
charset
container Move reaction to models/issues/ () 2022-03-31 17:20:39 +08:00
context
convert Add Package Registry () 2022-03-30 16:42:47 +08:00
csv
doctor
emoji
eventsource
generate
git Refactor git.Command.Run*, introduce RunWithContextString and RunWithContextBytes () 2022-03-31 13:56:22 +02:00
gitgraph
graceful
hcaptcha
highlight
hostmatcher
httpcache
httplib
indexer
json
lfs Update HTTP status codes to modern codes () 2022-03-23 12:54:07 +08:00
log
markup
metrics
migration
nosql
notification
options
packages Add Package Registry () 2022-03-30 16:42:47 +08:00
password
pprof
private
process Refactor git.Command.Run*, introduce RunWithContextString and RunWithContextBytes () 2022-03-31 13:56:22 +02:00
proxy
public
queue
recaptcha
references
repository
secret
session
setting
ssh
storage
structs Add Package Registry () 2022-03-30 16:42:47 +08:00
svg
sync
templates
test
timeutil
translation
typesniffer
updatechecker
upload
uri
user Add gitea-vet () 2020-04-05 07:20:50 +01:00
util Use a more general (and faster) method to sanitize URLs with credentials () 2022-03-31 10:25:40 +08:00
validation
web