Bug 703960

Summary: [PATCH] Handle indented comments in git config files
Product: [Fedora] Fedora Reporter: Todd Zullinger <tmz>
Component: GitPythonAssignee: David Cantrell <dcantrell>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dcantrell
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: GitPython-0.2.0-0.6.beta1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-11 04:20:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] Handle indented comments in git config files none

Description Todd Zullinger 2011-05-11 19:18:07 UTC
GitPython uses ConfigParser to parse git config files and it seems to be unable to parse some valid git config files.  I ran into this while using fedpkg-fixbranches.py:

$ fedpkg-fixbranches.py 
Checking status of upstream branch conversion
Traceback (most recent call last):
  File "/usr/bin/fedpkg-fixbranches.py", line 294, in <module>
    convert(args)
  File "/usr/bin/fedpkg-fixbranches.py", line 56, in convert
    re.search(fedpkg, remote.url)]
  File "/usr/lib/python2.6/site-packages/git/remote.py", line 442, in __getattr__
    return self._config_reader.get(attr)
  File "/usr/lib/python2.6/site-packages/git/remote.py", line 32, in <lambda>
    return lambda *args, **kwargs: self._call_config(attr, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/git/remote.py", line 38, in _call_config
    return getattr(self._config, method)(self._section_name, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/git/config.py", line 53, in assure_data_present
    self.read()
  File "/usr/lib/python2.6/site-packages/git/config.py", line 281, in read
    self._read(fp, fp.name)
  File "/usr/lib/python2.6/site-packages/git/config.py", line 246, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /home/tmz/.gitconfig
	[line 21]: '\t# This affects decoration collors in git log output\n'

The git config section in question looks like this:

[color "diff"]
	plain = white
	meta = bold green
	frag = bold yellow
	old = bold red
	new = bold cyan
	# This affects decoration colors in git log output
	#commit = bold black yellow
	whitespace = reverse red

It would be nice if GitPython didn't choke on config files that git has no issues with.

Comment 1 Todd Zullinger 2011-05-23 23:33:13 UTC
Created attachment 500524 [details]
[PATCH] Handle indented comments in git config files

I've filed a bug upstream and submitted a similar patch there.  See https://github.com/gitpython-developers/GitPython/issues/17

Comment 2 Fedora Update System 2011-05-28 16:07:19 UTC
GitPython-0.2.0-0.6.beta1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/GitPython-0.2.0-0.6.beta1.fc15

Comment 3 Fedora Update System 2011-05-28 16:08:22 UTC
GitPython-0.2.0-0.6.beta1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/GitPython-0.2.0-0.6.beta1.fc14

Comment 4 Fedora Update System 2011-05-28 16:09:46 UTC
GitPython-0.2.0-0.6.beta1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/GitPython-0.2.0-0.6.beta1.el6

Comment 5 Fedora Update System 2011-05-28 21:31:49 UTC
Package GitPython-0.2.0-0.6.beta1.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing GitPython-0.2.0-0.6.beta1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/GitPython-0.2.0-0.6.beta1.el6
then log in and leave karma (feedback).

Comment 6 Bug Zapper 2011-05-30 10:34:35 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Todd Zullinger 2011-06-08 00:56:23 UTC
Just for completeness, this was fixed upstream a little differently.  It was merged together with fixes for a few other potential config parse errors:

    https://github.com/gitpython-developers/GitPython/commit/ba825ea

Comment 8 Fedora Update System 2011-06-11 04:20:04 UTC
GitPython-0.2.0-0.6.beta1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2011-06-15 05:32:39 UTC
GitPython-0.2.0-0.6.beta1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2011-06-16 00:35:01 UTC
GitPython-0.2.0-0.6.beta1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.