mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
gitutil: sanitize root dir on WSL
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
19
util/gitutil/path_unix_test.go
Normal file
19
util/gitutil/path_unix_test.go
Normal 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"))
|
||||
}
|
Reference in New Issue
Block a user