Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Strip the line when matching for sections #22

Closed
wants to merge 1 commit into from

2 participants

@jkeating

The SECTCRE regex does not seem to ignore leading spaces before a
section in the config and will cause a traceback. However git itself
parses these files just fine. Stripping the line resolves the issue.
https://bugzilla.redhat.com/show_bug.cgi?id=706218

@jkeating jkeating Strip the line when matching for sections
The SECTCRE regex does not seem to ignore leading spaces before a
section in the config and will cause a traceback.  However git itself
parses these files just fine.  Stripping the line resolves the issue.
https://bugzilla.redhat.com/show_bug.cgi?id=706218
61d16f0
@Byron
Owner

Could you modify and existing fixture (like. git_config in test/fixtures) to contain lines that your change is fixing, maybe including some variations you make up that you think should be fine as well.
Then run the unit-tests (test_config.py) to be sure it actually works and doesn't break anything else.

Once that is verified, I will be glad to merge.
Thanks,
Sebastian

@jkeating
@Byron
Owner

I just use the nosetests executable from the git-python root dir or the ./git subdirectory, in your case you could specify the test suite, i.e. nosetests test/test_config.py.

With nosetests 1.0.0 and 0.10.4 the tests work flawlessly. For some tests, mock needs to be installed as well, maybe that's the cause of the issue.

@Byron
Owner

I have implemented the contents of this pull request and pushed the changes to the new 0.3 branch. This is to indicate that GitPython 0.3 reached the end of its life and is in maintenance mode. A proper release of 0.3 will follow.

Master now moved on to the latest stable development, which will be 0.4 one day. As master was reset, you will have to reset your local master as well.

Thanks for your participation,
Sebastian

@Byron Byron closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 28, 2011
  1. @jkeating

    Strip the line when matching for sections

    jkeating authored
    The SECTCRE regex does not seem to ignore leading spaces before a
    section in the config and will cause a traceback.  However git itself
    parses these files just fine.  Stripping the line resolves the issue.
    https://bugzilla.redhat.com/show_bug.cgi?id=706218
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  git/config.py
View
2  git/config.py
@@ -218,7 +218,7 @@ def _read(self, fp, fpname):
continue
else:
# is it a section header?
- mo = self.SECTCRE.match(line)
+ mo = self.SECTCRE.match(line.strip()) # strip the line to remove leading spaces
if mo:
sectname = mo.group('header')
if sectname in self._sections:
Something went wrong with that request. Please try again.