summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2023-01-22 10:02:15 +0100
committerGitHub <noreply@github.com>2023-01-22 10:02:15 +0100
commitcc92d5126b2fc80f7cc6866fc8f99b3ffb0189ae (patch)
tree35f8366a66261ee5710b5c4f8491fbaa544413c7 /git/repo/base.py
parentf594266acf09896608234947611fb3af356130dd (diff)
parentdf4dabb17c4e83c580d515894dbf7d57912ee554 (diff)
downloadgitpython-cc92d5126b2fc80f7cc6866fc8f99b3ffb0189ae.tar.gz
Merge pull request #1545 from Lightborne/fix_ignored
Fix ignored
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 30f71b0c..9cdf673e 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -873,8 +873,15 @@ class Repo(object):
"""
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