16 if len(sys.argv) != 3:
17 raise Exception(
'Expects exactly 2 arguments.')
18 args = [
'git',
'rev-parse',
'--resolve-git-dir', sys.argv[1]]
22 process = subprocess.Popen(args,
23 stdout=subprocess.PIPE,
24 stderr=subprocess.PIPE,
25 stdin=subprocess.PIPE,
27 universal_newlines=
True)
29 process = subprocess.Popen(args,
30 stdout=subprocess.PIPE,
31 stderr=subprocess.PIPE,
32 stdin=subprocess.PIPE,
34 universal_newlines=
True)
36 outs, _ = process.communicate()
38 if process.returncode != 0:
39 raise Exception(
'Got non-0 exit code from git.')
47if __name__ ==
'__main__':
def print(*args, **kwargs)