From a367a73a652f0d79e295f91c0463efda4962b27b Mon Sep 17 00:00:00 2001 From: Riley Housden Date: Fri, 19 Aug 2022 23:33:30 -0400 Subject: [PATCH] fix git_get_remote --- ext/system.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ext/system.py b/ext/system.py index 1b01065..1723e58 100644 --- a/ext/system.py +++ b/ext/system.py @@ -1,4 +1,3 @@ -import subprocess import asyncio import lightbulb @@ -25,7 +24,8 @@ async def get_git_branch(): return await create_subprocess("git", "rev-parse", "--abbrev-ref", "HEAD") async def get_git_remote(): - return await create_subprocess("git", "branch", "-r") + remote = await create_subprocess("git", "branch", "-vv") + return remote.split("[")[1].split("]")[0] async def get_git_head_diff_branch(branch: str) -> str: # diff HEAD to remote @@ -38,7 +38,6 @@ async def get_git_index_diff_branch(branch: str) -> str: async def get_git_commits_ahead_behind(branch: str, remote: str) -> tuple[int, int]: # commits ahead/behind remote output = await create_subprocess("git", "rev-list", "--left-right", "--count", branch+"..."+remote) - print("git_commmits_ahead:", output) commits_ahead = int(output.split()[0]) commits_behind = int(output.split()[1]) return commits_ahead, commits_behind