From 84a7fd194573a41424e9efe290aa4b905464f2df Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Mon, 1 Jul 2013 00:26:06 +0200 Subject: [PATCH] Added support for --exclude to the git-config support. In contrast to the -x/--exclude option that can be given on the command line, --exclude can not be set multiple times when used with git-config. Luckily, the same behavior can be attained by using the pipe ("|") character. Ie, specifying the following on the command line: -x "hello.txt" -x "goodbye.txt" is the same thing as: -x "hello.txt|goodbye.txt" when sent to git-config or the command line. --- gitinspector/config.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gitinspector/config.py b/gitinspector/config.py index 3a168a3..ed51e29 100644 --- a/gitinspector/config.py +++ b/gitinspector/config.py @@ -32,9 +32,12 @@ def __read_git_config__(variable, default_value): setting = setting.readlines()[0] setting = setting.decode("utf-8", "replace").strip() - if setting == "True" or setting == "true" or setting == "1": - return True - elif setting == "False" or setting == "false" or setting == "0": + if default_value == True or default_value == False: + if setting == "True" or setting == "true" or setting == "1": + return True + elif setting == "False" or setting == "false" or setting == "0": + return False + return False elif setting == "": return default_value @@ -48,6 +51,10 @@ def init(run): missing.set_checkout_missing(__read_git_config__("checkout-missing", False)) extensions.define(__read_git_config__("file-types", ",".join(extensions.get()))) + exclude = __read_git_config__("exclude", None): + if exclude != None: + filtering.add(exclude) + if not __read_git_config__("format", format.get_selected()): raise format.InvalidFormatError(_("specified output format not supported."))