Return the commit id of *ref* in the git repository at *path*.
(path, ref)
| 483 | |
| 484 | |
| 485 | def git_commit_id(path, ref): |
| 486 | """Return the commit id of *ref* in the git repository at *path*.""" |
| 487 | cmd = git_cmd_base(path) + ['show', ref] |
| 488 | try: |
| 489 | output = run_subprocess(cmd, stderr=None, universal_newlines=True)[0] |
| 490 | except CalledProcessError: |
| 491 | raise NameError("Unknown git reference '%s'" % ref) |
| 492 | commit = output.split('\n')[0] |
| 493 | assert commit[:7] == 'commit ' |
| 494 | return commit[7:] |
no test coverage detected
searching dependent graphs…