@@ -585,7 +585,7 @@ def _set_alternates(self, alts):
585585 doc = "Retrieve a list of alternates paths or set a list paths to be used as alternates" )
586586
587587 def is_dirty (self , index = True , working_tree = True , untracked_files = False ,
588- submodules = True ):
588+ submodules = True , path = None ):
589589 """
590590 :return:
591591 ``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,
600600 default_args = ['--abbrev=40' , '--full-index' , '--raw' ]
601601 if not submodules :
602602 default_args .append ('--ignore-submodules' )
603+ if path :
604+ default_args .append (path )
603605 if index :
604606 # diff index against HEAD
605607 if isfile (self .index .path ) and \
@@ -612,7 +614,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
612614 return True
613615 # END working tree handling
614616 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 )):
616618 return True
617619 # END untracked files
618620 return False
@@ -633,9 +635,10 @@ def untracked_files(self):
633635 consider caching it yourself."""
634636 return self ._get_untracked_files ()
635637
636- def _get_untracked_files (self , ** kwargs ):
638+ def _get_untracked_files (self , * args , * *kwargs ):
637639 # 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 ,
639642 untracked_files = True ,
640643 as_process = True ,
641644 ** kwargs )
0 commit comments