MCPcopy Index your code
hub / github.com/go-git/go-git / WindowsValidPath

Function WindowsValidPath

internal/pathutil/ntfs.go:53–58  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

51// caller decides whether they are permissible at the current path
52// position.
53func 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

Callers 2

validPathMethod · 0.92
TestWindowsValidPathFunction · 0.85

Calls 3

IsNTFSDotGitFunction · 0.85
IsDotGitNameFunction · 0.85
isWindowsReservedNameFunction · 0.85

Tested by 1

TestWindowsValidPathFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…