From 074842accb51b2a0c2c1193018d9f374ac5e948f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 6 Sep 2015 15:11:54 +0200 Subject: fix(config): ignore empty values in config file Similar to git, we now ignore options which have no value. Previously it would not handle it consistently, and throw a parsing error the first time the cache was built. Afterwards, it was fully usable though. Now we specifically check for the case of no-value options instead. Closes #349 --- git/test/test_config.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'git/test/test_config.py') diff --git a/git/test/test_config.py b/git/test/test_config.py index 7758a094..22f342aa 100644 --- a/git/test/test_config.py +++ b/git/test/test_config.py @@ -210,3 +210,10 @@ class TestBase(TestCase): self.assertEqual(w_config.get('alias', 'rbi'), '"!g() { git rebase -i origin/${1:-master} ; } ; g"') w_config.release() self.assertEqual(file_obj.getvalue(), self._to_memcache(fixture_path('.gitconfig')).getvalue()) + + def test_empty_config_value(self): + cr = GitConfigParser(fixture_path('git_config_with_empty_value'), read_only=True) + + assert cr.get_value('core', 'filemode'), "Should read keys with values" + + self.failUnlessRaises(cp.NoOptionError, cr.get_value, 'color', 'ui') -- cgit v1.2.1