diff options
author | Odegard, Ken <ken.odegard@gmail.com> | 2017-07-09 22:44:19 +0200 |
---|---|---|
committer | Odegard, Ken <ken.odegard@gmail.com> | 2017-07-09 22:44:19 +0200 |
commit | b56d6778ee678081e22c1897ede1314ff074122a (patch) | |
tree | db1371fd57edecb15a41e8ad099536856d22bd82 /git/cmd.py | |
parent | e8cb31db6b3970d1e983f10b0e0b5eeda8348c7e (diff) | |
download | gitpython-b56d6778ee678081e22c1897ede1314ff074122a.tar.gz |
Added ability to silence initial warning
Added the ability to silence the first refresh warning upon import by
setting an environment variable.
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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 |