initRepoWithChange creates a real git repository with one committed file and an uncommitted working-tree modification, returning the repo dir. There is a genuine textual diff between HEAD and the working tree.
(t *testing.T)
| 43 | // an uncommitted working-tree modification, returning the repo dir. There is a |
| 44 | // genuine textual diff between HEAD and the working tree. |
| 45 | func initRepoWithChange(t *testing.T) string { |
| 46 | t.Helper() |
| 47 | repo := t.TempDir() |
| 48 | |
| 49 | runGitTest(t, repo, "init", "-q") |
| 50 | runGitTest(t, repo, "config", "user.email", "test@example.com") |
| 51 | runGitTest(t, repo, "config", "user.name", "Test User") |
| 52 | runGitTest(t, repo, "config", "commit.gpgsign", "false") |
| 53 | |
| 54 | file := filepath.Join(repo, "sample.txt") |
| 55 | if err := os.WriteFile(file, []byte("line1\nline2\nline3\n"), 0o644); err != nil { |
| 56 | t.Fatalf("write sample.txt: %v", err) |
| 57 | } |
| 58 | runGitTest(t, repo, "add", "sample.txt") |
| 59 | runGitTest(t, repo, "commit", "-q", "-m", "initial commit") |
| 60 | |
| 61 | // Working-tree modification: a real, parseable diff vs HEAD. |
| 62 | if err := os.WriteFile(file, []byte("line1\nCHANGED\nline3\n"), 0o644); err != nil { |
| 63 | t.Fatalf("modify sample.txt: %v", err) |
| 64 | } |
| 65 | return repo |
| 66 | } |
| 67 | |
| 68 | // initRepoWithNonASCIIChange creates a repository whose changed file path |
| 69 | // contains both non-ASCII characters and Next.js-style route groups. It forces |
no test coverage detected