parameters: ()
return_statement: return (branch, '')
docstring: Determine current git branch
  
      Returns (branch name, ''), or (None, stderr output) if the branch name
      cannot be determined
docstring_summary: Determine current git branch
docstring_tokens: Determine current git branch
function: def getBranch():
      """Determine current git branch
  
      Returns (branch name, ''), or (None, stderr output) if the branch name
      cannot be determined"""
  
      command = [ 'git', 'symbolic-ref', '--short', 'HEAD' ]
      results = subprocess.run(command,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
  
      # git command failed
      if len(results.stderr) > 0:
          return (None, results.stderr)
  
      # Remove newline from output and convert to a string
      branch = results.stdout.rstrip().decode()
      if len(branch) > 0:
          # Strip trailing newline
          branch = results.stdout.decode()[0:-1]
  
      return (branch, '')
function_tokens: def getBranch ( ) : command = [ 'git' , 'symbolic-ref' , '--short' , 'HEAD' ] results = subprocess . run ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) # git command failed if len ( results . stderr ) > 0 : return ( None , results . stderr ) # Remove newline from output and convert to a string branch = results . stdout . rstrip ( ) . decode ( ) if len ( branch ) > 0 : # Strip trailing newline branch = results . stdout . decode ( ) [ 0 : - 1 ] return ( branch , '' )