mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Fix merge panic (#35606)
To prevent potential bugs, the logic in #35543 makes `gitcmd.Command` panic when attempting to override stdout or stderr. Instead of using `PrepareCmd`, this PR now uses the WithXXX methods directly to avoid the panic. Fix #35603
This commit is contained in:
		| @@ -37,6 +37,9 @@ type prTmpRepoContext struct { | ||||
| 	errbuf      *strings.Builder // any use should be preceded by a Reset and preferably after use | ||||
| } | ||||
|  | ||||
| // PrepareGitCmd prepares a git command with the correct directory, environment, and output buffers | ||||
| // This function can only be called with gitcmd.Run() | ||||
| // Do NOT use it with gitcmd.RunStd*() functions, otherwise it will panic | ||||
| func (ctx *prTmpRepoContext) PrepareGitCmd(cmd *gitcmd.Command) *gitcmd.Command { | ||||
| 	ctx.outbuf.Reset() | ||||
| 	ctx.errbuf.Reset() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user