jonschlinkert 7 years ago
parent 853a149463
commit c8a2c653ee

@ -160,6 +160,11 @@ parse.expandKeys = function(config) {
function parseIni(str, options) {
const opts = Object.assign({}, options);
str = str.replace(/\[(\S+) "(.*)"\]/g, function(m, $1, $2) {
return $1 && $2 ? `[${$1} "${$2.split('.').join('\\.')}"]` : m;
});
const config = ini.parse(str);
if (opts.expandKeys === true) {
return parse.expandKeys(config);

@ -0,0 +1,11 @@
[branch "2.0"]
remote = origin
merge = refs/heads/devel
[branch "devel"]
remote = origin
merge = refs/heads/devel
[branch "master"]
remote = origin
merge = refs/heads/devel

@ -45,6 +45,15 @@ describe('parse-git-config', function() {
.catch(cb);
});
it('should not expand dots in keys in config', function(cb) {
parse({ path: fixture('_gitconfig-branch'), expandKeys: true })
.then(config => {
assert.deepEqual(Object.keys(config.branch), ['devel', 'master', '2.0'])
cb();
})
.catch(cb);
});
it('should include other config sources', function(cb) {
parse({ path: fixture('_gitconfig'), include: true }, function(err, config) {
assert(!err);

Loading…
Cancel
Save