Fix Windows worktree test by normalizing path separators

Git on Windows uses forward slashes in .git files, even though Windows
uses backslashes. Use filepath.ToSlash() to normalize paths for comparison
in the worktree migration tests.

Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-17 06:54:43 +00:00
parent d82dd80f86
commit a12656da90

View file

@ -132,7 +132,7 @@ func TestDoMigrate(t *testing.T) {
if err != nil {
t.Fatal(err)
}
wantGitdir := "gitdir: " + filepath.Join(dest, ".git", "worktrees", "wt")
wantGitdir := "gitdir: " + filepath.ToSlash(filepath.Join(dest, ".git", "worktrees", "wt"))
if got := strings.TrimSpace(string(content)); got != wantGitdir {
t.Errorf("worktree .git:\n got: %s\n want: %s", got, wantGitdir)
}
@ -197,7 +197,7 @@ func TestDoMigrate(t *testing.T) {
if err != nil {
t.Fatal(err)
}
wantGitdir := "gitdir: " + filepath.Join(dest, ".git", "worktrees", "feat")
wantGitdir := "gitdir: " + filepath.ToSlash(filepath.Join(dest, ".git", "worktrees", "feat"))
if got := strings.TrimSpace(string(content)); got != wantGitdir {
t.Errorf("internal worktree .git:\n got: %s\n want: %s", got, wantGitdir)
}