From d5a39b039ae1953598e42d03f180a2baab65cdc0 Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Fri, 29 Nov 2024 11:09:48 +0000 Subject: [PATCH] fixup! fix: non-ascii paths in git walker Signed-off-by: Brian McGee --- cmd/root_test.go | 8 +++++++- .../emoji \360\237\225\260\357\270\217/README.md" | 2 +- walk/git.go | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/root_test.go b/cmd/root_test.go index 85beb70..9d42266 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -183,6 +183,12 @@ func TestAllowMissingFormatter(t *testing.T) { treefmt(t, withArgs("--allow-missing-formatter"), withNoError(t), + withStats(t, map[stats.Type]int{ + stats.Traversed: 33, + stats.Matched: 0, + stats.Formatted: 0, + stats.Changed: 0, + }), ) }) @@ -1346,7 +1352,7 @@ func TestGit(t *testing.T) { withStats(t, map[stats.Type]int{ stats.Traversed: 82, stats.Matched: 82, - stats.Formatted: 51, // the echo formatter should only be applied to the new files + stats.Formatted: 50, // the echo formatter should only be applied to the new files stats.Changed: 0, }), ) diff --git "a/test/examples/emoji \360\237\225\260\357\270\217/README.md" "b/test/examples/emoji \360\237\225\260\357\270\217/README.md" index e9168db..2965834 100644 --- "a/test/examples/emoji \360\237\225\260\357\270\217/README.md" +++ "b/test/examples/emoji \360\237\225\260\357\270\217/README.md" @@ -1 +1 @@ -# Hello World \ No newline at end of file +# Hello World diff --git a/walk/git.go b/walk/git.go index 8283700..cb5c4c8 100644 --- a/walk/git.go +++ b/walk/git.go @@ -105,7 +105,7 @@ LOOP: files[n] = &File{ Path: path, - RelPath: filepath.Join(g.path, g.scanner.Text()), + RelPath: filepath.Join(g.path, entry), Info: info, } n++