parameters: (cwd='./', dot_git_qualifies=False, no_git_cmd_result=False)
docstring: Returns boolean as to whether *cwd* is under git control. When no ``git``
      command available in environment, *no_git_cmd_result* returned. If within
      the .git directory of a git repository, *dot_git_qualifies* returned.
docstring_summary: Returns boolean as to whether *cwd* is under git control. When no ``git``
      command available in environment, *no_git_cmd_result* returned. If within
      the .git directory of a git repository, *dot_git_qualifies* returned.
docstring_tokens: Returns boolean as to whether * cwd * is under git control . When no git command available in environment * no_git_cmd_result * returned . If within the . git directory of a git repository * dot_git_qualifies * returned .
function: def is_git_repo(cwd='./', dot_git_qualifies=False, no_git_cmd_result=False):
      """Returns boolean as to whether *cwd* is under git control. When no ``git``
      command available in environment, *no_git_cmd_result* returned. If within
      the .git directory of a git repository, *dot_git_qualifies* returned.
  
      """
      command = 'git rev-parse --is-inside-work-tree'
      try:
          process = subprocess.Popen(command.split(),
                                     stderr=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     cwd=cwd,
                                     universal_newlines=True)
      except EnvironmentError as e:
          # most likely, git command not available
          return no_git_cmd_result
  
      (out, err) = process.communicate()
  
      if process.returncode != 0:
          # fatal: Not a git repository (or any of the parent directories): .git
          return False
  
      if out.strip() == 'true':
          # in a git repo and not within .git dir
          return True
  
      if out.strip() == 'false':
          # in a git repo in .git dir
          return dot_git_qualifies
function_tokens: def is_git_repo ( cwd = './' , dot_git_qualifies = False , no_git_cmd_result = False ) : command = 'git rev-parse --is-inside-work-tree' try : process = subprocess . Popen ( command . split ( ) , stderr = subprocess . PIPE , stdout = subprocess . PIPE , cwd = cwd , universal_newlines = True ) except EnvironmentError as e : # most likely, git command not available return no_git_cmd_result ( out , err ) = process . communicate ( ) if process . returncode != 0 : # fatal: Not a git repository (or any of the parent directories): .git return False if out . strip ( ) == 'true' : # in a git repo and not within .git dir return True if out . strip ( ) == 'false' : # in a git repo in .git dir return dot_git_qualifies