aboutsummaryrefslogtreecommitdiff
path: root/ref/refname/root_syntax.go
diff options
context:
space:
mode:
Diffstat (limited to 'ref/refname/root_syntax.go')
-rw-r--r--ref/refname/root_syntax.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/ref/refname/root_syntax.go b/ref/refname/root_syntax.go
new file mode 100644
index 00000000..97a15cb9
--- /dev/null
+++ b/ref/refname/root_syntax.go
@@ -0,0 +1,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
+}