[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] UTF-8 byte order marker in .git/config

On Wed, May 30, 2012 at 6:53 AM, Marc Strapetz
<marc.strapetz@xxxxxxxxxxx> wrote:
> jgit currently can't process .git/config files which start with an UTF-8
> byte order marker (EF BB BF). CGit can handle such files.
>
> Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Cannot read
> file d:\repo\.git\config
> at
> org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:156)
> at
> org.eclipse.jgit.storage.file.FileRepository.loadRepoConfig(FileRepository.java:224)
> at
> org.eclipse.jgit.storage.file.FileRepository.<init>(FileRepository.java:169)

But does CGit treat these as UTF-8, or just a config file with a funny
leading garbage? For some reason I thought CGit just parsed the config
file using US-ASCII and dealt with the values as opaque runs of bytes.

JGit wants to do this, but clearly failed. Its a bug. We should either
understand the major byte order markers, or parse the file as US-ASCII
the way I think CGit does. (Well actually its ISO-8859-1 parsing
probably, but it later may treat a given value as UTF-8.)