Merge branch 'dev-2.0'

master
jonschlinkert 7 years ago
commit 7ac029e8a7

@ -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