Read my_head and remote_head with a single subprocess call.

This commit is contained in:
voussoir 2020-01-28 01:12:24 -08:00
parent 2bc3d4caa6
commit 1abe5a615b

View file

@ -50,13 +50,9 @@ def checkup_committed():
return (committed, details)
def checkup_pushed():
command = [GIT, 'rev-parse', '@']
my_head = subprocess.check_output(command, stderr=subprocess.STDOUT)
my_head = my_head.strip().decode()
command = [GIT, 'rev-parse', '@{u}']
remote_head = subprocess.check_output(command, stderr=subprocess.STDOUT)
remote_head = remote_head.strip().decode()
command = [GIT, 'rev-parse', '@', '@{u}']
output = subprocess.check_output(command, stderr=subprocess.STDOUT)
(my_head, remote_head) = output.strip().decode().splitlines()
command = [GIT, 'merge-base', '@', '@{u}']
merge_base = subprocess.check_output(command, stderr=subprocess.STDOUT)