def read_ref(refname, repo_dir=None):
 refs = list_refs(refnames=[refname], repo_dir=repo_dir, limit_to_heads=True)
 l = tuple(islice(refs, 2))
 if l:
  assert (len(l) == 1)
  return l[0][1]
 else:
  return None

def read_ref ( refname , repo_dir = None ) : refs = list_refs ( refnames = [ refname ] , repo_dir = repo_dir , limit_to_heads = True ) l = tuple ( islice ( refs , 2 ) ) if l : assert ( len ( l ) == 1 ) return l [ 0 ] [ 1 ] else : return None
get the commit id of the most recent commit made on a given ref .