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/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`
3 years ago
..
admin Add Package Registry (#16510) 3 years ago
auth Update HTTP status codes to modern codes (#18063) 3 years ago
dev Move user related model into models/user (#17781) 3 years ago
events Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
explore Update HTTP status codes to modern codes (#18063) 3 years ago
feed Add `ContextUser` to http request context (#18798) 3 years ago
org Add Package Registry (#16510) 3 years ago
repo Refactor `git.Command.Run*`, introduce `RunWithContextString` and `RunWithContextBytes` (#19266) 3 years ago
user Add Package Registry (#16510) 3 years ago
auth.go Let web and API routes have different auth methods group (#19168) 3 years ago
auth_windows.go Let web and API routes have different auth methods group (#19168) 3 years ago
base.go Update HTTP status codes to modern codes (#18063) 3 years ago
goget.go Update HTTP status codes to modern codes (#18063) 3 years ago
home.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
metrics.go Update HTTP status codes to modern codes (#18063) 3 years ago
nodeinfo.go Add nodeinfo endpoint for federation purposes (#16953) 4 years ago
swagger_json.go Refactor routers directory (#15800) 4 years ago
web.go Add Package Registry (#16510) 3 years ago