소스 검색

builder: fix running git commands on Windows

Setting cmd.Env overrides the default of passing through the parent
process' environment, which works out fine most of the time, except when
it doesn't. For whatever reason, leaving out all the environment causes
git-for-windows sh.exe subprocesses to enter an infinite loop of
access violations during Cygwin initialization in certain environments
(specifically, our very own dev container image).

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 년 전
부모
커밋
94672c89cc
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      builder/remotecontext/git/gitutils.go

+ 1 - 1
builder/remotecontext/git/gitutils.go

@@ -212,7 +212,7 @@ func (repo gitRepo) gitWithinDir(dir string, args ...string) ([]byte, error) {
 	cmd := exec.Command("git", args...)
 	cmd := exec.Command("git", args...)
 	cmd.Dir = dir
 	cmd.Dir = dir
 	// Disable unsafe remote protocols.
 	// Disable unsafe remote protocols.
-	cmd.Env = append(cmd.Env, "GIT_PROTOCOL_FROM_USER=0")
+	cmd.Env = append(cmd.Environ(), "GIT_PROTOCOL_FROM_USER=0")
 
 
 	if repo.isolateConfig {
 	if repo.isolateConfig {
 		cmd.Env = append(cmd.Env,
 		cmd.Env = append(cmd.Env,