def git_commit_id(path, ref):
 cmd = (git_cmd_base(path) + ['show', ref])
 try:
  output = run_subprocess(cmd, stderr=None, universal_newlines=True)[0]
 except CalledProcessError:
  raise NameError(("Unknown git reference '%s'" % ref))
 commit = output.split('\n')[0]
 assert (commit[:7] == 'commit ')
 return commit[7:]

def git_commit_id ( path , ref ) : cmd = ( git_cmd_base ( path ) + [ 'show' , ref ] ) try : output = run_subprocess ( cmd , stderr = None , universal_newlines = True ) [ 0 ] except CalledProcessError : raise NameError ( ( "Unknown git reference '%s'" % ref ) ) commit = output . split ( '\n' ) [ 0 ] assert ( commit [ : 7 ] == 'commit ' ) return commit [ 7 : ]
return the commit id of *ref* in the git repository at *path* .