We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ddb604 commit df4dabbCopy full SHA for df4dabb
git/repo/base.py
@@ -873,8 +873,15 @@ def ignored(self, *paths: PathLike) -> List[str]:
873
"""
874
try:
875
proc: str = self.git.check_ignore(*paths)
876
- except GitCommandError:
877
- return []
+ except GitCommandError as err:
+ # If return code is 1, this means none of the items in *paths
878
+ # are ignored by Git, so return an empty list. Raise the
879
+ # exception on all other return codes.
880
+ if err.status == 1:
881
+ return []
882
+ else:
883
+ raise
884
+
885
return proc.replace("\\\\", "\\").replace('"', "").split("\n")
886
887
@property
0 commit comments