From 4fb36e1d41159f1c9dc86843c3adc7b9b2cf4cb3 Mon Sep 17 00:00:00 2001 From: Jefferson Ramos Date: Fri, 13 Sep 2024 13:51:43 -0300 Subject: [PATCH] [test only] safe.directory not global on repository unittest --- pkg/testing/testing.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/testing/testing.go b/pkg/testing/testing.go index f953b7d26b..352c71bc3c 100644 --- a/pkg/testing/testing.go +++ b/pkg/testing/testing.go @@ -145,9 +145,10 @@ func ServeRepo(name string, t *testing.T) string { ) // This is to prevent "fatal: detected dubious ownership in repository at " while executing // unit tests on other environments (such as Prow CI) - cmd := exec.Command("git", "config", "--global", "--add", "safe.directory", abs) - _, err := cmd.CombinedOutput() + cmd := exec.Command("git", "config", "--add", "safe.directory", abs) + o, err := cmd.CombinedOutput() if err != nil { + t.Log("error adding safe.directory ", string(o)) t.Fatal(err) } return fmt.Sprintf("%v/%v", url, repo)