Skip to content

Commit

Permalink
[test only] safe.directory not global on repository unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
jrangelramos committed Sep 13, 2024
1 parent 3f0bb14 commit 4fb36e1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ func ServeRepo(name string, t *testing.T) string {
)
// This is to prevent "fatal: detected dubious ownership in repository at <source_reposutory_path>" 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)
Expand Down

0 comments on commit 4fb36e1

Please sign in to comment.