We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8d00703 + 384dbf7 commit efdd399Copy full SHA for efdd399
worktree.go
@@ -428,6 +428,10 @@ var worktreeDeny = map[string]struct{}{
428
func validPath(paths ...string) error {
429
for _, p := range paths {
430
parts := strings.FieldsFunc(p, func(r rune) bool { return (r == '\\' || r == '/') })
431
+ if len(parts) == 0 {
432
+ return fmt.Errorf("invalid path: %q", p)
433
+ }
434
+
435
if _, denied := worktreeDeny[strings.ToLower(parts[0])]; denied {
436
return fmt.Errorf("invalid path prefix: %q", p)
437
}
worktree_test.go
@@ -2957,6 +2957,8 @@ func TestValidPath(t *testing.T) {
2957
{"git~1", true},
2958
{"a/../b", true},
2959
{"a\\..\\b", true},
2960
+ {"/", true},
2961
+ {"", true},
2962
{".gitmodules", false},
2963
{".gitignore", false},
2964
{"a..b", false},
0 commit comments