forgejo/routers/web
wxiaoguang b877504b03
Refactor git.Command.Run*, introduce RunWithContextString and RunWithContextBytes (#19266)
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
..
admin Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
auth Update HTTP status codes to modern codes (#18063) 2022-03-23 12:54:07 +08:00
dev Move user related model into models/user (#17781) 2021-11-24 17:49:20 +08:00
events Renamed ctx.User to ctx.Doer. (#19161) 2022-03-22 15:03:22 +08:00
explore Update HTTP status codes to modern codes (#18063) 2022-03-23 12:54:07 +08:00
feed Add ContextUser to http request context (#18798) 2022-03-26 17:04:22 +08:00
org Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
repo Refactor git.Command.Run*, introduce RunWithContextString and RunWithContextBytes (#19266) 2022-03-31 13:56:22 +02:00
user Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00
auth.go Let web and API routes have different auth methods group (#19168) 2022-03-28 12:46:28 +08:00
auth_windows.go Let web and API routes have different auth methods group (#19168) 2022-03-28 12:46:28 +08:00
base.go Update HTTP status codes to modern codes (#18063) 2022-03-23 12:54:07 +08:00
goget.go Update HTTP status codes to modern codes (#18063) 2022-03-23 12:54:07 +08:00
home.go Renamed ctx.User to ctx.Doer. (#19161) 2022-03-22 15:03:22 +08:00
metrics.go Update HTTP status codes to modern codes (#18063) 2022-03-23 12:54:07 +08:00
nodeinfo.go Add nodeinfo endpoint for federation purposes (#16953) 2021-09-28 01:38:06 +02:00
swagger_json.go Refactor routers directory (#15800) 2021-06-09 01:33:54 +02:00
web.go Add Package Registry (#16510) 2022-03-30 16:42:47 +08:00