def current_branch():
 head = git.git_path(u'HEAD')
 try:
  key = core.stat(head).st_mtime
  if (_current_branch.key == key):
   return _current_branch.value
 except OSError:
  key = 0
 (status, data, err) = git.rev_parse(u'HEAD', symbolic_full_name=True)
 if (status != 0):
  data = _read_git_head(head)
 for refs_prefix in (u'refs/heads/', u'refs/remotes/', u'refs/tags/'):
  if data.startswith(refs_prefix):
   value = data[len(refs_prefix):]
   _current_branch.key = key
   _current_branch.value = value
   return value
 return data

def current_branch ( ) : head = git . git_path ( u'HEAD' ) try : key = core . stat ( head ) . st_mtime if ( _current_branch . key == key ) : return _current_branch . value except OSError : key = 0 ( status , data , err ) = git . rev_parse ( u'HEAD' , symbolic_full_name = True ) if ( status != 0 ) : data = _read_git_head ( head ) for refs_prefix in ( u'refs/heads/' , u'refs/remotes/' , u'refs/tags/' ) : if data . startswith ( refs_prefix ) : value = data [ len ( refs_prefix ) : ] _current_branch . key = key _current_branch . value = value return value return data
return the current branch .