Introduce gbr_branch_foreach(), as git_branch_foreach() has gone away

At some point libgit2 lost its git_branch_foreach() helper, but it's
easily emulatable.