libgit2/git2go — pull request #21 by Merovius (2013-05-16 12:17:41+00:00)
Title: Implement Packbuilder-Support

This basically just wraps the libgit2-functions. There is two exceptions:
* I modified the semantics of git_packbuilder_foreach to return a chan []byte. The actual git_packbuilder_foreach call is run in a seperate go-routine. This feels more „go-like“.
* I wrapped git_packbuilder_write to (*Packbuilder).WriteToFile, to make the next change possible.

Even more go-like than the channel-approach from above is the Write(w io.Writer)-semantic I added in the second commit. This makes it easy to write the pack out to any writer by wrapping ForEach.
In my opinion this could replace the whole ForEach-/callback mess with a more minimal/clean interface which is as powerful (instead of specifying a callback, the user creates a Writer, which is called with the same semantics).

Also, (*Packbuilder).WriteToFile could be removed (requiring the user to open a file herself and pass the *os.File to (*Packbuilder).Write. This would introduce some C-Call-overhead, I think.

If we do all of the above, we can replace (*Packbuilder).Written by our own implementation, reducing C-Call-overhead (to compensate a little bit for the above introduction of overhead).

Bevor reducing the interface, I wanted to hear your thoughts on all that, if we want to do it (or some of it) we should do it before merging in my opinion.