mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-28 09:15:18 +02:00
refactor: git patch apply (#38637)
Merge duplicate code and add a unit test There are already integration test cases in `TestEditor` -> `WebGitCommitEmail` for these two endpoints.
This commit is contained in:
@@ -38,11 +38,13 @@ type Command struct {
|
||||
configArgs []string
|
||||
|
||||
// Dir is the working dir for the git command, however:
|
||||
// FIXME: this could be incorrect in many cases, for example:
|
||||
// FIXME: GIT-DIR-ARGUMENT: this could be incorrect in many cases, for example:
|
||||
// * /some/path/.git
|
||||
// * /some/path/.git/gitea-data/data/repositories/user/repo.git
|
||||
// If "user/repo.git" is invalid/broken, then running git command in it will use "/some/path/.git", and produce unexpected results
|
||||
// The correct approach is to use `--git-dir" global argument or "GIT_DIR=..." environment variable.
|
||||
// Actually, when working with a bare repo, the current directory should not be the git dir,
|
||||
// otherwise some git commands might overwrite git dir internal files by a repo file.
|
||||
gitDir string
|
||||
|
||||
cmd *exec.Cmd
|
||||
|
||||
Reference in New Issue
Block a user