markty-TOML
markty-TOML copied to clipboard
Incorrect output when parsing `.git/config`
If a branch name contains a dot, the output is incorrect.
Repro
import toml from 'markty-toml'
toml(`
[branch "v1.0"]
remote = origin
merge = refs/heads/v1.0
`)
Expected:
{
'branch "v1.0"': { remote: 'origin', merge: 'refs/heads/v1.0' }
}
Actual:
{
'branch "v1': { '0"': { remote: 'origin', merge: 'refs/heads/v1.0' } }
}
Mmmm it has been a long time I have not work on this project to be honest. You might be totally right, that's an edge case that I missed completely...
For the time being, could you try to put your values between quotes ??
Like
[branch "v1.0"]
remote = "origin"
merge = "refs/heads/v1.0"
If you look closer at my example, the problem is with the [branch "v1.0"]
part :)
I've worked around this by using config-ini-parser instead
Oh you are right, sorry for that I misread.
Yeah, there is no way around that for the moment.