@@ -161,7 +161,7 @@ class Git(LazyMixin):
161161 Set its value to 'full' to see details about the returned values.
162162 """
163163__slots__ = ("_working_dir" ,"cat_file_all" ,"cat_file_header" ,"_version_info" ,
164- "_git_options" ,"_environment" )
164+ "_git_options" ,"_persistent_git_options" , " _environment" )
165165
166166_excluded_ = ('cat_file_all' ,'cat_file_header' ,'_version_info' )
167167
@@ -386,6 +386,7 @@ def __init__(self, working_dir=None):
386386super (Git ,self ).__init__ ()
387387self ._working_dir = working_dir
388388self ._git_options = ()
389+ self ._persistent_git_options = []
389390
390391# Extra environment variables to pass to git commands
391392self ._environment = {}
@@ -402,6 +403,20 @@ def __getattr__(self, name):
402403return LazyMixin .__getattr__ (self ,name )
403404return lambda * args ,** kwargs :self ._call_process (name ,* args ,** kwargs )
404405
406+ def set_persistent_git_options (self ,** kwargs ):
407+ """Specify command line options to the git executable
408+ for subsequent subcommand calls
409+
410+ :param kwargs:
411+ is a dict of keyword arguments.
412+ these arguments are passed as in _call_process
413+ but will be passed to the git command rather than
414+ the subcommand.
415+ """
416+
417+ self ._persistent_git_options = self .transform_kwargs (
418+ split_single_char_options = True ,** kwargs )
419+
405420def _set_cache_ (self ,attr ):
406421if attr == '_version_info' :
407422# We only use the first 4 numbers, as everthing else could be strings in fact (on windows)
@@ -820,7 +835,10 @@ def _call_process(self, method, *args, **kwargs):
820835
821836call = [self .GIT_PYTHON_GIT_EXECUTABLE ]
822837
823- # add the git options, the reset to empty
838+ # add persistent git options
839+ call .extend (self ._persistent_git_options )
840+
841+ # add the git options, then reset to empty
824842# to avoid side_effects
825843call .extend (self ._git_options )
826844self ._git_options = ()