WindowsValidPath reports whether part is a valid Windows / NTFS path component for the worktree filesystem abstraction. It rejects NTFS-disguised variants of `.git` and `git~1` (trailing spaces, periods, Alternate Data Streams) and Windows reserved device names. Bare `.git` and `git~1` are allowed a
(part string)
| 51 | // caller decides whether they are permissible at the current path |
| 52 | // position. |
| 53 | func WindowsValidPath(part string) bool { |
| 54 | if IsNTFSDotGit(part) && !IsDotGitName(part) { |
| 55 | return false |
| 56 | } |
| 57 | return !isWindowsReservedName(part) |
| 58 | } |
| 59 | |
| 60 | // windowsReservedNames lists the Windows reserved device names. |
| 61 | // A path component is reserved if its base name (ignoring trailing |
searching dependent graphs…