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 a036a49
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ def __init__(
else:
self.odb = odbt(rootpath)

# Check dubious ownership
try:
if not self.bare:
_ = 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 a036a49

Please sign in to comment.