code: func ParseRefToTypeAndName(fullref string) (t RefType, name string) {
  	const localPrefix = "refs/heads/"
  	const remotePrefix = "refs/remotes/"
  	const localTagPrefix = "refs/tags/"
  
  	if fullref == "HEAD" {
  		name = fullref
  		t = RefTypeHEAD
  	} else if strings.HasPrefix(fullref, localPrefix) {
  		name = fullref[len(localPrefix):]
  		t = RefTypeLocalBranch
  	} else if strings.HasPrefix(fullref, remotePrefix) {
  		name = fullref[len(remotePrefix):]
  		t = RefTypeRemoteBranch
  	} else if strings.HasPrefix(fullref, localTagPrefix) {
  		name = fullref[len(localTagPrefix):]
  		t = RefTypeLocalTag
  	} else {
  		name = fullref
  		t = RefTypeOther
  	}
  	return
  }
docs: // Get the type & name of a git reference