fix git_get_remote

This commit is contained in:
Riley Housden 2022-08-19 23:33:30 -04:00
parent fc86622c1f
commit a367a73a65
Signed by: InValidFire
GPG Key ID: 0D6208F6DF56B4D8
1 changed files with 2 additions and 3 deletions

View File

@ -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