def resolveconfig(effective_config, branch):
    """Resolve a ref to its effective config."""
    for regex, config in effective_config['refs'].items():
        if regex.match(branch):
            config['re'] = regex
            return config.copy()
