mirror of https://github.com/knative/func.git
test: preventing dubios ownership repository error on git unit tests (#2499)
This commit is contained in:
parent
81169a4d80
commit
84f4caf724
|
@ -143,6 +143,13 @@ func ServeRepo(name string, t *testing.T) string {
|
|||
repo = filepath.Base(path)
|
||||
url = RunGitServer(abs, t)
|
||||
)
|
||||
// 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()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return fmt.Sprintf("%v/%v", url, repo)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue