diff options
author | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 15:38:46 -0600 |
---|---|---|
committer | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 15:39:56 -0600 |
commit | df4dabb17c4e83c580d515894dbf7d57912ee554 (patch) | |
tree | 35f8366a66261ee5710b5c4f8491fbaa544413c7 /git/repo/base.py | |
parent | 2ddb604ae8a7fd1069857c8194155d109565e6bb (diff) | |
download | gitpython-df4dabb17c4e83c580d515894dbf7d57912ee554.tar.gz |
Raise exception if return code from check-ignore is not 1
Diffstat (limited to 'git/repo/base.py')
-rw-r--r-- | git/repo/base.py | 11 |
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 |