libgit2/libgit2 — pull request #2620 by alanjrogers (2014-10-16 03:20:48+00:00)
Title: [WIP] Fix config snapshotting 

I ran into an issue in GitHub for Mac where we would push a local branch for the first time, then we'd look up the tracking branch and it wouldn't be found. :confused:

It looks like `git_branch_upstream_name` is using a stale version of the repository's config when it looks up the `branch.*.remote` and `branch.*.merge` config keys and since it can't find them the upstream branch name isn't found.

I think the problem is that `git_repository_config_snapshot` doesn't refresh the config before creating a new snapshot. So I've added a test to exercise that case and then fixed it. :boom::camel: