aboutsummaryrefslogtreecommitdiff
path: root/ref/name/root_syntax.go
blob: 97a15cb966944a832667b1b1779dccd4605267ba (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package refname

// IsRootSyntax reports whether name matches Git's all-caps root-ref syntax.
func IsRootSyntax(name string) bool {
	for i := range len(name) {
		ch := name[i]
		if (ch < 'A' || ch > 'Z') && ch != '-' && ch != '_' {
			return false
		}
	}

	return true
}