Skip to content

Commit df6fa49

Browse files
saroad2Byron
authored andcommitted
Find paths ignored in .gitignore
1 parent 8a9f8c5 commit df6fa49

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

git/repo/base.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,19 @@ def _get_untracked_files(self, *args, **kwargs):
697697
finalize_process(proc)
698698
return untracked_files
699699

700+
def get_ignored(self, *paths):
701+
"""Checks if paths are ignored via .gitignore
702+
Doing so using the "git check-ignore" method.
703+
704+
:param paths: List of paths to check whether they are ignored or not
705+
:return: sublist of ignored paths
706+
"""
707+
try:
708+
proc = self.git.check_ignore(*paths)
709+
except GitCommandError:
710+
return []
711+
return proc.replace("\\\\", "\\").replace('"', "").split("\n")
712+
700713
@property
701714
def active_branch(self):
702715
"""The name of the currently active branch.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy