Skip to content

Commit

Permalink
Avoid setting global git config
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Oct 30, 2024
1 parent aaeeb64 commit 5da54b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gitindex/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ func TestIndexTinyRepo(t *testing.T) {
// Create a repo with one file in it.
dir := t.TempDir()
executeCommand(t, dir, exec.Command("git", "init", "-b", "main", "repo"))
executeCommand(t, dir, exec.Command("git", "config", "--global", "user.name", "Thomas"))
executeCommand(t, dir, exec.Command("git", "config", "--global", "user.email", "[email protected]"))

if err := os.WriteFile(filepath.Join(dir, "repo", "file1.go"), []byte("package main\n\nfunc main() {}\n"), 0644); err != nil {
repoDir := filepath.Join(dir, "repo")
executeCommand(t, repoDir, exec.Command("git", "config", "user.name", "Thomas"))
executeCommand(t, repoDir, exec.Command("git", "config", "user.email", "[email protected]"))

if err := os.WriteFile(filepath.Join(repoDir, "file1.go"), []byte("package main\n\nfunc main() {}\n"), 0644); err != nil {
t.Fatalf("WriteFile: %v", err)
}

repoDir := filepath.Join(dir, "repo")
executeCommand(t, repoDir, exec.Command("git", "add", "."))
executeCommand(t, repoDir, exec.Command("git", "commit", "-m", "initial commit"))

Expand Down

0 comments on commit 5da54b9

Please sign in to comment.