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) return (committed, details)
def checkup_pushed(): def checkup_pushed():
command = [GIT, 'rev-parse', '@'] command = [GIT, 'rev-parse', '@', '@{u}']
my_head = subprocess.check_output(command, stderr=subprocess.STDOUT) output = subprocess.check_output(command, stderr=subprocess.STDOUT)
my_head = my_head.strip().decode() (my_head, remote_head) = output.strip().decode().splitlines()
command = [GIT, 'rev-parse', '@{u}']
remote_head = subprocess.check_output(command, stderr=subprocess.STDOUT)
remote_head = remote_head.strip().decode()
command = [GIT, 'merge-base', '@', '@{u}'] command = [GIT, 'merge-base', '@', '@{u}']
merge_base = subprocess.check_output(command, stderr=subprocess.STDOUT) merge_base = subprocess.check_output(command, stderr=subprocess.STDOUT)