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 authored and Byron committed Nov 29, 2023
1 parent 5c6a4f4 commit 5be123e
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 or Git.is_cygwin()):
_ = 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 5be123e

Please sign in to comment.