@@ -585,7 +585,7 @@ def _set_alternates(self, alts):
585
585
doc = "Retrieve a list of alternates paths or set a list paths to be used as alternates" )
586
586
587
587
def is_dirty (self , index = True , working_tree = True , untracked_files = False ,
588
- submodules = True ):
588
+ submodules = True , path = None ):
589
589
"""
590
590
:return:
591
591
``True``, the repository is considered dirty. By default it will react
@@ -600,6 +600,8 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
600
600
default_args = ['--abbrev=40' , '--full-index' , '--raw' ]
601
601
if not submodules :
602
602
default_args .append ('--ignore-submodules' )
603
+ if path :
604
+ default_args .append (path )
603
605
if index :
604
606
# diff index against HEAD
605
607
if isfile (self .index .path ) and \
@@ -612,7 +614,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
612
614
return True
613
615
# END working tree handling
614
616
if untracked_files :
615
- if len (self ._get_untracked_files (ignore_submodules = not submodules )):
617
+ if len (self ._get_untracked_files (path , ignore_submodules = not submodules )):
616
618
return True
617
619
# END untracked files
618
620
return False
@@ -633,9 +635,10 @@ def untracked_files(self):
633
635
consider caching it yourself."""
634
636
return self ._get_untracked_files ()
635
637
636
- def _get_untracked_files (self , ** kwargs ):
638
+ def _get_untracked_files (self , * args , * *kwargs ):
637
639
# make sure we get all files, no only untracked directores
638
- proc = self .git .status (porcelain = True ,
640
+ proc = self .git .status (* args ,
641
+ porcelain = True ,
639
642
untracked_files = True ,
640
643
as_process = True ,
641
644
** kwargs )
0 commit comments