diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-06-27 02:15:26 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-06-26 14:15:26 -0400 |
commit | edc94c70413048107ea728ff330f32ca3de6df88 (patch) | |
tree | cf5bcc5ba8ee4b2e585dc14a6cf7440ce88bc073 /models/pull.go | |
parent | 161e12e157a48f9bcd2de50c187c77444aa2a9a8 (diff) | |
download | gitea-edc94c70413048107ea728ff330f32ca3de6df88.tar.gz gitea-edc94c70413048107ea728ff330f32ca3de6df88.zip |
Monitor all git commands; move blame to git package and replace git as a variable (#6864)
* monitor all git commands; move blame to git package and replace git as a variable
* use git command but not other commands
* fix build
* move exec.Command to git.NewCommand
* fix fmt
* remove unrelated changes
* remove unrelated changes
* refactor IsEmpty and add tests
* fix tests
* fix tests
* fix tests
* fix tests
* remove gitLogger
* fix fmt
* fix isEmpty
* fix lint
* fix tests
Diffstat (limited to 'models/pull.go')
-rw-r--r-- | models/pull.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/models/pull.go b/models/pull.go index 38976d37ec..2f5412651b 100644 --- a/models/pull.go +++ b/models/pull.go @@ -463,7 +463,7 @@ func (pr *PullRequest) getMergeCommit() (*git.Commit, error) { // Check if a pull request is merged into BaseBranch _, stderr, err := process.GetManager().ExecDirEnv(-1, "", fmt.Sprintf("isMerged (git merge-base --is-ancestor): %d", pr.BaseRepo.ID), []string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()}, - "git", "merge-base", "--is-ancestor", headFile, pr.BaseBranch) + git.GitExecutable, "merge-base", "--is-ancestor", headFile, pr.BaseBranch) if err != nil { // Errors are signaled by a non-zero status that is not 1 @@ -486,7 +486,7 @@ func (pr *PullRequest) getMergeCommit() (*git.Commit, error) { // Get the commit from BaseBranch where the pull request got merged mergeCommit, stderr, err := process.GetManager().ExecDirEnv(-1, "", fmt.Sprintf("isMerged (git rev-list --ancestry-path --merges --reverse): %d", pr.BaseRepo.ID), []string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()}, - "git", "rev-list", "--ancestry-path", "--merges", "--reverse", cmd) + git.GitExecutable, "rev-list", "--ancestry-path", "--merges", "--reverse", cmd) if err != nil { return nil, fmt.Errorf("git rev-list --ancestry-path --merges --reverse: %v %v", stderr, err) } else if len(mergeCommit) < 40 { @@ -548,7 +548,7 @@ func (pr *PullRequest) testPatch(e Engine) (err error) { var stderr string _, stderr, err = process.GetManager().ExecDirEnv(-1, "", fmt.Sprintf("testPatch (git read-tree): %d", pr.BaseRepo.ID), []string{"GIT_DIR=" + pr.BaseRepo.RepoPath(), "GIT_INDEX_FILE=" + indexTmpPath}, - "git", "read-tree", pr.BaseBranch) + git.GitExecutable, "read-tree", pr.BaseBranch) if err != nil { return fmt.Errorf("git read-tree --index-output=%s %s: %v - %s", indexTmpPath, pr.BaseBranch, err, stderr) } @@ -568,7 +568,7 @@ func (pr *PullRequest) testPatch(e Engine) (err error) { _, stderr, err = process.GetManager().ExecDirEnv(-1, "", fmt.Sprintf("testPatch (git apply --check): %d", pr.BaseRepo.ID), []string{"GIT_INDEX_FILE=" + indexTmpPath, "GIT_DIR=" + pr.BaseRepo.RepoPath()}, - "git", args...) + git.GitExecutable, args...) if err != nil { for i := range patchConflicts { if strings.Contains(stderr, patchConflicts[i]) { |