libgit2/rugged — pull request #81 by arthurschreiber (2012-06-20 19:04:54+00:00)
Title: Add branch functionality

Similar to #72, this patchset exposes libgit2's branch functionality in Rugged. I already submitted these changes once as #63, but as that one was not reopened, I though that I'd just open a new pull request.

In difference to #72, the API here is modeled after libgit2sharp, and was touched up a tiny bit to feel more rubyesque:

`Rugged::Repository#branches` was added to return a `Rugged::BranchCollection` instance, that allows enumeration over a repositories' branches. It includes the `Enumerable`, so branches can easily be mapped, filtered, e.g.:

```ruby
@repo.branches.any? { |b| b.name.starts_with?("feature/") }
```

It also exposes a "quick-access" to branches using `[]`:

```ruby
@repo.branches["master"]
```

Also, it exposes methods to `create`, `move`, and `delete` individual branches.

The objects that are returned by a `Rugged::BranchCollection` are `Rugged::Branch` instances, which can be compared and whose `tip`, `name` and `canonical_name` can be looked up.

Also, branch names in UTF-8 are correctly handled.