libgit2/libgit2 — pull request #782 by nulltoken (2012-06-21 17:02:28+00:00)
Title: Branch foreach

In order to help disambiguating, Git adds a `remotes/` prefix when being asked to list all branches (through `git branch -a`).
However when running `git branch -r`, the branches are displayed without any `remotes/` prefix

Current implementation of `git_branch_list` always adds the `remotes/` prefix, and this is the only way to tell if a retrieved branch is remote or not.

As this is a bit fragile, and not really helpful, this PR proposes to replace `git_branch_list()` with a `git_branch_foreach()` function. When invoked, the callback is being passed the branch name (without prefix) and its type.

This PR is made of two commits. If it doesn't seem sensible to remove existing `git_branch_list()` it can be easily dropped.

- Add git_branch_foreach()
- Drop git_branch_list()