Helper to retrieve git config options

def _git_config(cwd, user, password, output_encoding=None):
    '''
    Helper to retrieve git config options
    '''
    contextkey = 'git.config.' + cwd
    if contextkey not in __context__:
        git_dir = rev_parse(cwd,
                            opts=['--git-dir'],
                            user=user,
                            password=password,
                            ignore_retcode=True,
                            output_encoding=output_encoding)
        if not os.path.isabs(git_dir):
            paths = (cwd, git_dir, 'config')
        else:
            paths = (git_dir, 'config')
        __context__[contextkey] = os.path.join(*paths)
    return __context__[contextkey]