Skip to content

Commit

Permalink
Adding dubious ownership handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Alvarado committed Nov 28, 2023
1 parent 07f3641 commit 87ec461
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ def __init__(
else:
self.odb = odbt(rootpath)

# Check dubious ownership
try:
_ = self.git.status()
except GitCommandError as err:
if "detected dubious ownership" in err.stderr:
err_msg = f"Detected dubious ownership in repository at: {epath}"
raise InvalidGitRepositoryError(err_msg) from None
raise

def __enter__(self) -> "Repo":
return self

Expand Down

0 comments on commit 87ec461

Please sign in to comment.