Skip to content

Commit

Permalink
Check NotGitRepository in dulwich read_remote
Browse files Browse the repository at this point in the history
Adds a `NotGitRepository` check to the `DulwichDvcsCmd` `read_remote` method.
  • Loading branch information
tsalemink committed Feb 22, 2024
1 parent 2ac750c commit 5948574
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pmr2/wfctrl/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,12 @@ def commit(self, workspace, message, **kw):
return output, b'', 0 if output else 1

def read_remote(self, workspace, target_remote=None, **kw):
with porcelain.open_repo_closing(workspace.working_dir) as repo:
_, name = porcelain.get_remote_repo(repo, target_remote)
return name
try:
with porcelain.open_repo_closing(workspace.working_dir) as repo:
_, name = porcelain.get_remote_repo(repo, target_remote)
return name
except NotGitRepository:
return None

def write_remote(self, workspace, target_remote=None, **kw):
target_remote = target_remote or self.default_remote
Expand Down

0 comments on commit 5948574

Please sign in to comment.