summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 0e9315a2..ae7721df 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -231,10 +231,19 @@ class Git(LazyMixin):
# None) we only warn the user and simply set the default
# executable
cls.GIT_PYTHON_GIT_EXECUTABLE = cls.git_exec_name
- print(dedent("""\
- WARNING: %s
- All git commands will error until this is rectified.
- """) % err)
+
+ # test if the user didn't want a warning
+ nowarn = os.environ.get("GIT_PYTHON_NOWARN", "false")
+ nowarn = nowarn.lower() in ["t", "true", "y", "yes"]
+
+ if not nowarn:
+ print(dedent("""\
+ WARNING: %s
+ All git commands will error until this is rectified.
+
+ This initial warning can be silenced in the future by setting the environment variable:
+ export GIT_PYTHON_NOWARN=true
+ """) % err)
else:
# after the first setup (when GIT_PYTHON_GIT_EXECUTABLE
# is no longer None) we raise an exception and reset the