Debian Codegraph @

internal/pathutil/dotgit.go

raw
1 package pathutil
2
3 import "strings"
4
5 // IsDotGitName reports whether name is `.git` or its 8.3 NTFS short
6 // alias `git~1`, case-insensitively. Both are forbidden as path
7 // components (and as submodule names) because they refer to the
8 // repository's own metadata directory.
9 //
10 // File names that do not conform to the 8.3 format (up to eight
11 // characters for the basename, three for the file extension) are
12 // associated with a so-called "short name" on NTFS — at least on
13 // the `C:` drive by default — which means that `git~1/` is a valid
14 // way to refer to `.git/`.
15 func IsDotGitName(name string) bool {
16 switch strings.ToLower(name) {
17 case ".git", "git~1":
18 return true
19 }
20 return false
21 }