async def git_check_ref_filter(commands, ref_filter):
  """Use the git command to validate a ref filter.

  Args:
    commands: GitPatrolCommands object used to execute external commands.
    ref_filter: The git ref filter to validate.
  Returns:
    True for a valid ref filter. False otherwise.
  """
  git_subproc = await commands.git(
      'check-ref-format', '--allow-onelevel', '--refspec-pattern', ref_filter)
  await git_subproc.communicate()
  returncode = await git_subproc.wait()
  return returncode == 0