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 Dec 7, 2023
1 parent 07f3641 commit 35eb810
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,12 @@ def _parse_object_header(self, header_line: str) -> Tuple[str, str, int]:
tokens = header_line.split()
if len(tokens) != 3:
if not tokens:
raise ValueError("SHA could not be resolved, git returned: %r" % (header_line.strip()))
err_msg = (
f"SHA is empty, possible dubious ownership in the repository "
f"""at {self._working_dir}.\n If this is unintended run:\n\n """
f""" "git config --global --add safe.directory {self._working_dir}" """
)
raise ValueError(err_msg)
else:
raise ValueError("SHA %s could not be resolved, git returned: %r" % (tokens[0], header_line.strip()))
# END handle actual return value
Expand Down

0 comments on commit 35eb810

Please sign in to comment.