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/repo
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
..
activity.go Propagate context and ensure git commands run in request context (#17868) 3 years ago
attachment.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
blame.go Refactor i18n, use Locale to provide i18n/translation related functions (#18648) 3 years ago
branch.go Make git.OpenRepository accept Context (#19260) 3 years ago
cherry_pick.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
commit.go Make git.OpenRepository accept Context (#19260) 3 years ago
compare.go Make git.OpenRepository accept Context (#19260) 3 years ago
download.go format with gofumpt (#18184) 3 years ago
editor.go Update HTTP status codes to modern codes (#18063) 3 years ago
editor_test.go Make git.OpenRepository accept Context (#19260) 3 years ago
http.go Refactor `git.Command.Run*`, introduce `RunWithContextString` and `RunWithContextBytes` (#19266) 3 years ago
http_test.go Fix http path bug (#16117) 4 years ago
issue.go Move reaction to models/issues/ (#19264) 3 years ago
issue_content_history.go Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163) 3 years ago
issue_dependency.go Update HTTP status codes to modern codes (#18063) 3 years ago
issue_label.go Move some issue methods as functions (#19255) 3 years ago
issue_label_test.go Update HTTP status codes to modern codes (#18063) 3 years ago
issue_lock.go Update HTTP status codes to modern codes (#18063) 3 years ago
issue_stopwatch.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
issue_test.go format with gofumpt (#18184) 3 years ago
issue_timetrack.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
issue_watch.go Update HTTP status codes to modern codes (#18063) 3 years ago
lfs.go Make git.OpenRepository accept Context (#19260) 3 years ago
main_test.go Decouple unit test code from business code (#17623) 3 years ago
middlewares.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
migrate.go Use a more general (and faster) method to sanitize URLs with credentials (#19239) 3 years ago
milestone.go Only view milestones from current repo (#18414) 3 years ago
packages.go Add Package Registry (#16510) 3 years ago
patch.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
projects.go Move project files into models/project sub package (#17704) 3 years ago
projects_test.go Decouple unit test code from business code (#17623) 3 years ago
pull.go Make git.OpenRepository accept Context (#19260) 3 years ago
pull_review.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
release.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
release_test.go Decouple unit test, remove intermediate `unittestbridge` package (#17662) 3 years ago
repo.go Move init repository related functions to modules (#19159) 3 years ago
search.go Update HTTP status codes to modern codes (#18063) 3 years ago
setting.go Move organization related structs into sub package (#18518) 3 years ago
setting_protected_branch.go Move organization related structs into sub package (#18518) 3 years ago
settings_test.go Move organization related structs into sub package (#18518) 3 years ago
tag.go Move organization related structs into sub package (#18518) 3 years ago
topic.go Renamed ctx.User to ctx.Doer. (#19161) 3 years ago
view.go Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163) 3 years ago
webhook.go Add Package Registry (#16510) 3 years ago
wiki.go Make git.OpenRepository accept Context (#19260) 3 years ago
wiki_test.go Make git.OpenRepository accept Context (#19260) 3 years ago