def all_refs(split=False, git=git):
 local_branches = []
 remote_branches = []
 tags = []
 triple = _triple
 query = (triple(u'refs/tags', tags), triple(u'refs/heads', local_branches), triple(u'refs/remotes', remote_branches))
 out = git.for_each_ref(format=u'%(refname)')[STDOUT]
 for ref in out.splitlines():
  for (prefix, prefix_len, dst) in query:
   if (ref.startswith(prefix) and (not ref.endswith(u'/HEAD'))):
    dst.append(ref[prefix_len:])
    continue
 if split:
  return (local_branches, remote_branches, tags)
 else:
  return ((local_branches + remote_branches) + tags)

def all_refs ( split = False , git = git ) : local_branches = [ ] remote_branches = [ ] tags = [ ] triple = _triple query = ( triple ( u'refs/tags' , tags ) , triple ( u'refs/heads' , local_branches ) , triple ( u'refs/remotes' , remote_branches ) ) out = git . for_each_ref ( format = u'%(refname)' ) [ STDOUT ] for ref in out . splitlines ( ) : for ( prefix , prefix_len , dst ) in query : if ( ref . startswith ( prefix ) and ( not ref . endswith ( u'/HEAD' ) ) ) : dst . append ( ref [ prefix_len : ] ) continue if split : return ( local_branches , remote_branches , tags ) else : return ( ( local_branches + remote_branches ) + tags )
return a tuple of .