Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 2 test/fixtures/git_config_with_extra_whitespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[init]
defaultBranch = trunk
2 changes: 2 additions & 0 deletions 2 test/fixtures/git_config_with_quotes_whitespace_outside
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[init]
defaultBranch = "trunk"
10 changes: 9 additions & 1 deletion 10 test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ def test_complex_aliases(self):
self._to_memcache(fixture_path(".gitconfig")).getvalue(),
)

def test_config_with_extra_whitespace(self):
cr = GitConfigParser(fixture_path("git_config_with_extra_whitespace"), read_only=True)
self.assertEqual(cr.get("init", "defaultBranch"), "trunk")

def test_empty_config_value(self):
cr = GitConfigParser(fixture_path("git_config_with_empty_value"), read_only=True)

Expand All @@ -413,9 +417,13 @@ def test_config_with_quotes(self):
self.assertEqual(cr.get("user", "email"), "cveal05@gmail.com")

def test_config_with_quotes_with_literal_whitespace(self):
cr = GitConfigParser(fixture_path("git_config_with_quotes_whitespace"), read_only=True)
cr = GitConfigParser(fixture_path("git_config_with_quotes_whitespace_inside"), read_only=True)
self.assertEqual(cr.get("core", "commentString"), "# ")

def test_config_with_quotes_with_whitespace_outside_value(self):
cr = GitConfigParser(fixture_path("git_config_with_quotes_whitespace_outside"), read_only=True)
self.assertEqual(cr.get("init", "defaultBranch"), "trunk")

def test_get_values_works_without_requiring_any_other_calls_first(self):
file_obj = self._to_memcache(fixture_path("git_config_multiple"))
cr = GitConfigParser(file_obj, read_only=True)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.