'Read a .gitconfig file into a dict'

def _read_config_file(self, path):

    config = {}
    header_simple = re.compile(u'^\\[(\\s+)]$')
    header_subkey = re.compile(u'^\\[(\\s+)    "(\\s+)"\\]$')
    with core.xopen(path, u'rt') as f:
        file_lines = f.readlines()
    stripped_lines = [line.strip() for line in file_lines]
    lines = [line for line in stripped_lines if bool(line)]
    prefix = u''
    for line in lines:
        if line.startswith(u'#'):
            continue
        match = header_simple.match(line)
        if match:
            prefix = (match.group(1) + u'.')
            continue
        match = header_subkey.match(line)
        if match:
            prefix = (((match.group(1) + u'.') + match.group(2)) + u'.')
            continue
        (k, v) = _config_key_value(line, u'=')
        k = (prefix + k)
        self._map[k.lower()] = k
        config[k] = v
    return config
