checkWritableRefName function

void checkWritableRefName(
  1. String ref
)

Raises GitInvalidRefNameException when ref cannot be the name of a reference the write operations of GitRefs and GitRefTransaction accept: a refs/... name, the rules of invalidRefNameReason applying to it, or one reference of specialRefNames. Any other one-level name is refused.

Implementation

void checkWritableRefName(String ref) {
  if (specialRefNames.contains(ref)) {
    return;
  }
  if (!ref.startsWith('refs/')) {
    throw GitInvalidRefNameException(
      name: ref,
      reason: 'a written reference is a refs/... name or a well-known '
          'pseudo-reference',
    );
  }
  checkRefName(ref);
}