Skip to content

delete bom symbol #708

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

Closed
wants to merge 1 commit into from
Closed

delete bom symbol #708

wants to merge 1 commit into from

Conversation

batchar2
Copy link

@batchar2 batchar2 commented Dec 8, 2017

Hi!
Error fix:

import git
repository = git.Repo("/home/bat/Apps/fsoft/")
repository.submodules

Traceback (most recent call last):
File "", line 1, in
File "/home/bat/Apps/GitPython/git/repo/base.py", line 323, in submodules
return Submodule.list_items(self)
File "/home/bat/Apps/GitPython/git/util.py", line 942, in list_items
out_list.extend(cls.iter_items(repo, *args, **kwargs))
File "/home/bat/Apps/GitPython/git/objects/submodule/base.py", line 1171, in iter_items
for sms in parser.sections():
File "/home/bat/Apps/GitPython/git/config.py", line 78, in assure_data_present
self.read()
File "/home/bat/Apps/GitPython/git/config.py", line 412, in read
self._read(fp, fp.name)
File "/home/bat/Apps/GitPython/git/config.py", line 337, in _read
raise cp.MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/bat/Apps/fsoft/.gitmodules', line: 1
'\ufeff[submodule "eflib"]\n'

@Byron
Copy link
Member

Byron commented Dec 11, 2017

@batchar2 Thanks a lot for the fix! This one should be easy to test, too! Could you have a look at test_config.py and add a test that reads such a file?
Also I am wondering what happens if a BOM is removed, and the file is changed afterwards so it gets written back to disk. If I remember correctly the UTF-8 standard assures files don't need a BOM to be decodable correctly?

@Byron Byron closed this Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants