gitutil: sanitize root dir on WSL

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-12-15 15:33:10 +01:00
parent 8484fcdd57
commit ac5b3241b1
5 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,19 @@
//go:build !windows
// +build !windows
package gitutil
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSanitizePathUnix(t *testing.T) {
assert.Equal(t, "/home/foobar", sanitizePath("/home/foobar"))
}
func TestSanitizePathWSL(t *testing.T) {
t.Setenv("WSL_DISTRO_NAME", "Ubuntu")
assert.Equal(t, "/mnt/c/Users/foobar", sanitizePath("C:\\Users\\foobar"))
}