mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-23 15:53:36 +05:00
fix(RepoManager): check if git dir exists
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -69,6 +69,9 @@ class RepoManager:
|
|||||||
:param repo: repository to extract the values from
|
:param repo: repository to extract the values from
|
||||||
:return: String in form of "<orga>/<name>"
|
:return: String in form of "<orga>/<name>"
|
||||||
"""
|
"""
|
||||||
|
if not repo.exists() and not repo.joinpath(".git").exists():
|
||||||
|
return "-"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = ["git", "-C", repo, "config", "--get", "remote.origin.url"]
|
cmd = ["git", "-C", repo, "config", "--get", "remote.origin.url"]
|
||||||
result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
|
result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
|
||||||
@@ -78,7 +81,7 @@ class RepoManager:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_local_commit(repo: Path) -> str:
|
def get_local_commit(repo: Path) -> str:
|
||||||
if not repo.exists() and repo.joinpath(".git").exists():
|
if not repo.exists() and not repo.joinpath(".git").exists():
|
||||||
return "-"
|
return "-"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -89,7 +92,7 @@ class RepoManager:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_remote_commit(repo: Path) -> str:
|
def get_remote_commit(repo: Path) -> str:
|
||||||
if not repo.exists() and repo.joinpath(".git").exists():
|
if not repo.exists() and not repo.joinpath(".git").exists():
|
||||||
return "-"
|
return "-"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user