mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	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
This commit is contained in:
		
				
					committed by
					
						 techknowlogick
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							161e12e157
						
					
				
				
					commit
					edc94c7041
				
			| @@ -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]) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user