libgit2/libgit2sharp — pull request #314 by jamill (2013-02-04 22:35:03+00:00)
Title: Teach BranchCollection to disambiguate local and remote branch names

When there is a local branch whose short name is the same as an existing remote branch, the branch is counted as a local branch twice, and the remote branch to not be listed at all.

For instance, `refs/heads/origin/master` and `refs/remotes/origin/master` both have the short name `origin/master`. When we look up the branch by it's short name, both of these will resolve to the local branch.

This leads to the Branch enumerator (in `BranchCollection`) to count both branches as local branches. This is because the enumerator currently only uses the short name of the branch to populate the list of branches, and thus both the local and remote branch resolve to the local branch.

The fix is to use the GitBranchType parameter to disambiguate between the local and remote branch and prefix the branch name. As part of this change, I went and made the code a little bit more resilient to an unknown `GitBranchType` enum value in the callback. If we are not concerned about this error, the code change becomes quite a bit smaller.