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.
This commit is contained in:
Adam Waldenberg 2013-07-01 00:26:06 +02:00
parent bfdac450c4
commit 84a7fd1945

View file

@ -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."))