summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-06-10 13:54:31 +0200
committerSebastian Thiel <byronimo@gmail.com>2015-06-10 13:54:31 +0200
commitb8e700e952d135c6903b97f022211809338232e5 (patch)
tree5fa42fe6ce23a055e8305ac869786c2140b92359
parent539980d51c159cb9922d0631a2994835b4243808 (diff)
parent5385cbd969cc8727777d503a513ccee8372cd506 (diff)
downloadgitpython-b8e700e952d135c6903b97f022211809338232e5.tar.gz
Merge branch 'submodule_fix' of https://github.com/Javex/GitPython into Javex-submodule_fix
-rw-r--r--git/repo/base.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index e59cb0c7..bb9fb72c 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -563,7 +563,8 @@ class Repo(object):
alternates = property(_get_alternates, _set_alternates,
doc="Retrieve a list of alternates paths or set a list paths to be used as alternates")
- def is_dirty(self, index=True, working_tree=True, untracked_files=False):
+ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
+ consider_submodules=True):
"""
:return:
``True``, the repository is considered dirty. By default it will react
@@ -575,7 +576,9 @@ class Repo(object):
return False
# start from the one which is fastest to evaluate
- default_args = ('--abbrev=40', '--full-index', '--raw')
+ default_args = ['--abbrev=40', '--full-index', '--raw']
+ if not consider_submodules:
+ default_args.append('--ignore-submodules')
if index:
# diff index against HEAD
if isfile(self.index.path) and \
@@ -588,7 +591,10 @@ class Repo(object):
return True
# END working tree handling
if untracked_files:
- if len(self.untracked_files):
+ kwargs = {}
+ if not consider_submodules:
+ kwargs['ignore_submodules'] = True
+ if len(self._get_untracked_files(**kwargs)):
return True
# END untracked files
return False
@@ -604,10 +610,14 @@ class Repo(object):
:note:
ignored files will not appear here, i.e. files mentioned in .gitignore"""
+ return self._get_untracked_files()
+
+ def _get_untracked_files(self, **kwargs):
# make sure we get all files, no only untracked directores
proc = self.git.status(porcelain=True,
untracked_files=True,
- as_process=True)
+ as_process=True,
+ **kwargs)
# Untracked files preffix in porcelain mode
prefix = "?? "
untracked_files = list()