File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -231,10 +231,19 @@ def refresh(cls, path=None):
231231 # None) we only warn the user and simply set the default
232232 # executable
233233 cls .GIT_PYTHON_GIT_EXECUTABLE = cls .git_exec_name
234- print (dedent ("""\
235- WARNING: %s
236- All git commands will error until this is rectified.
237- """ ) % err )
234+
235+ # test if the user didn't want a warning
236+ nowarn = os .environ .get ("GIT_PYTHON_NOWARN" , "false" )
237+ nowarn = nowarn .lower () in ["t" , "true" , "y" , "yes" ]
238+
239+ if not nowarn :
240+ print (dedent ("""\
241+ WARNING: %s
242+ All git commands will error until this is rectified.
243+
244+ This initial warning can be silenced in the future by setting the environment variable:
245+ export GIT_PYTHON_NOWARN=true
246+ """ ) % err )
238247 else :
239248 # after the first setup (when GIT_PYTHON_GIT_EXECUTABLE
240249 # is no longer None) we raise an exception and reset the
You can’t perform that action at this time.
0 commit comments