Skip to content

Commit a771e10

Browse files
committed
refactor(repo): parameter renaming and cleanup
* renamed `consider_submodules` to `submodules` to be in line with the existing parameters. Nowadays I would prefer the `consider_` prefix, but can't change the existing API and thus stick to the current naming scheme. * reduced amount of code in one portion to make it more maintainable. Related to #294
1 parent b8e700e commit a771e10

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

git/repo/base.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def _set_alternates(self, alts):
564564
doc="Retrieve a list of alternates paths or set a list paths to be used as alternates")
565565

566566
def is_dirty(self, index=True, working_tree=True, untracked_files=False,
567-
consider_submodules=True):
567+
submodules=True):
568568
"""
569569
:return:
570570
``True``, the repository is considered dirty. By default it will react
@@ -577,7 +577,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
577577

578578
# start from the one which is fastest to evaluate
579579
default_args = ['--abbrev=40', '--full-index', '--raw']
580-
if not consider_submodules:
580+
if not submodules:
581581
default_args.append('--ignore-submodules')
582582
if index:
583583
# diff index against HEAD
@@ -591,10 +591,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
591591
return True
592592
# END working tree handling
593593
if untracked_files:
594-
kwargs = {}
595-
if not consider_submodules:
596-
kwargs['ignore_submodules'] = True
597-
if len(self._get_untracked_files(**kwargs)):
594+
if len(self._get_untracked_files(ignore_submodules=not submodules)):
598595
return True
599596
# END untracked files
600597
return False

0 commit comments

Comments
 (0)