aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/tutorial.rst8
-rw-r--r--git/repo/base.py15
2 files changed, 19 insertions, 4 deletions
diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst
index 632d2d0c..7cc296d8 100644
--- a/doc/source/tutorial.rst
+++ b/doc/source/tutorial.rst
@@ -343,6 +343,14 @@ This one sets a custom script to be executed in place of `ssh`, and can be used
with repo.git.custom_environment(GIT_SSH=ssh_executable):
repo.remotes.origin.fetch()
+Here's an example executable that can be used in place of the `ssh_executable` above::
+
+ #!/bin/sh
+ ID_RSA=/var/lib/openshift/5562b947ecdd5ce939000038/app-deployments/id_rsa
+ exec /usr/bin/ssh -o StrictHostKeyChecking=no -i $ID_RSA "$@"
+
+Please note that the script must be executable (i.e. `chomd +x script.sh`). `StrictHostKeyChecking=no` is used to avoid prompts asking to save the hosts key to `~/.ssh/known_hosts`, which happens in case you run this as daemon.
+
You might also have a look at `Git.update_environment(...)` in case you want to setup a changed environment more permanently.
Submodule Handling
diff --git a/git/repo/base.py b/git/repo/base.py
index e59cb0c7..f9d4ad6d 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,
+ 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 submodules:
+ default_args.append('--ignore-submodules')
if index:
# diff index against HEAD
if isfile(self.index.path) and \
@@ -588,7 +591,7 @@ class Repo(object):
return True
# END working tree handling
if untracked_files:
- if len(self.untracked_files):
+ if len(self._get_untracked_files(ignore_submodules=not submodules)):
return True
# END untracked files
return False
@@ -604,10 +607,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()