-
-
Notifications
You must be signed in to change notification settings - Fork 933
Parsing error on git config #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is this issue for the correct library? I can't find for instance a client.py in gitpython. |
Sorry, |
git-python uses the (downright terrible) standard configparser implementation, which is very picky. |
I am able to reproduce the error and believe the only way to fix it is to use a different/better parser implementation. There seem to be alternatives which are available on pypi as well, and I am confident I will find something suitable. |
I ended up improving the current (and custom) config parser implementation to the point where it can handle multi-line values correctly. There is a new test-case which verifies that git-python returns exactly the same value as git does. it config -f git/test/fixtures/git_config_with_comments --get "merge.railsschema.driver"
ruby -e '
system %(git), %(merge-file), %(--marker-size=%L), %(%A), %(%O), %(%B)
b = File.read(%(%A))
b.sub!(/^<+ .*\nActiveRecord::Schema\.define.:version => (\d+). do\n=+\nActiveRecord::Schema\.define.:version => (\d+). do\n>+ .*/) do
%(ActiveRecord::Schema.define(:version => #{[$1, $2].max}) do)
end
File.open(%(%A), %(w)) {|f| f.write(b)}
exit 1 if b.include?(%(<)*%L)' |
Also, just for fun, I have recorded the process of fixing this issue. |
The error is below, doing a
config.get_value("user", "name")
It happens on this .gitconfig after line 142. If you remove those parts, then it works fine.
https://github.com/cjhveal/dotfiles/blob/master/git/gitconfig.symlink
The text was updated successfully, but these errors were encountered: