Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Raise exception if return code from check-ignore is not 1
  • Loading branch information
Lightborne committed Jan 21, 2023
commit df4dabb17c4e83c580d515894dbf7d57912ee554
11 changes: 9 additions & 2 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,15 @@ def ignored(self, *paths: PathLike) -> List[str]:
"""
try:
proc: str = self.git.check_ignore(*paths)
except GitCommandError:
return []
except GitCommandError as err:
# If return code is 1, this means none of the items in *paths
# are ignored by Git, so return an empty list. Raise the
# exception on all other return codes.
if err.status == 1:
return []
else:
raise

return proc.replace("\\\\", "\\").replace('"', "").split("\n")

@property
Expand Down