From d1e12cbf67f46282695460c17036709a2f2a1e8d Mon Sep 17 00:00:00 2001 From: Artem Zinnatullin Date: Tue, 13 Dec 2022 15:28:55 -0700 Subject: [PATCH 1/3] Disable git advice on detached checkout --- bootstrap/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/git.go b/bootstrap/git.go index 6bfd9e6a63..3e1012ca04 100644 --- a/bootstrap/git.go +++ b/bootstrap/git.go @@ -44,7 +44,7 @@ func gitCheckout(ctx context.Context, sh shellRunner, gitCheckoutFlags, referenc return fmt.Errorf("%q is not a valid git ref format", reference) } - commandArgs := []string{"checkout"} + commandArgs := []string{ "-c", "advice.detachedHead=false", "checkout"} commandArgs = append(commandArgs, individualCheckoutFlags...) commandArgs = append(commandArgs, reference) From 34ae3a392c2d3b152f47d59220fd56a579f02348 Mon Sep 17 00:00:00 2001 From: Artem Zinnatullin Date: Thu, 15 Dec 2022 20:28:32 -0700 Subject: [PATCH 2/3] fix test --- bootstrap/git_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/git_test.go b/bootstrap/git_test.go index f862df09b5..2c1bb7552b 100644 --- a/bootstrap/git_test.go +++ b/bootstrap/git_test.go @@ -176,7 +176,7 @@ func TestGitCheckoutValidatesRef(t *testing.T) { } func TestGitCheckout(t *testing.T) { - sh := new(mockShellRunner).Expect("git", "checkout", "-f", "-q", "main") + sh := new(mockShellRunner).Expect("git", "-c", "advice.detachedHead=false", "checkout", "-f", "-q", "main") defer sh.Check(t) err := gitCheckout(context.Background(), sh, "-f -q", "main") require.NoError(t, err) From c0dc277707e7ddb26b39ee70e3834c678998d200 Mon Sep 17 00:00:00 2001 From: Artem Zinnatullin Date: Thu, 15 Dec 2022 20:48:00 -0700 Subject: [PATCH 3/3] fix go fmt --- bootstrap/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/git.go b/bootstrap/git.go index 3e1012ca04..8cb3140be5 100644 --- a/bootstrap/git.go +++ b/bootstrap/git.go @@ -44,7 +44,7 @@ func gitCheckout(ctx context.Context, sh shellRunner, gitCheckoutFlags, referenc return fmt.Errorf("%q is not a valid git ref format", reference) } - commandArgs := []string{ "-c", "advice.detachedHead=false", "checkout"} + commandArgs := []string{"-c", "advice.detachedHead=false", "checkout"} commandArgs = append(commandArgs, individualCheckoutFlags...) commandArgs = append(commandArgs, reference)