libgit2/libgit2 — pull request #2014 by mgbowen (2013-12-26 04:14:52+00:00)
Title: Function-based options initializers

In response to #1997, I've implemented a function-based `git_merge_opts` initializer, which would allow `GIT_MERGE_OPTS_INIT` to be used from C++. It would also allow for wrappers like libgit2sharp to use `GIT_MERGE_OPTS_INIT` directly via the function. I'd love some feedback on the interface before I implement them for other options structures, though!

I have the function return the options structure directly instead of taking a pointer to a structure that would be memcpy'd to, primarily because it means that `GIT_MERGE_OPTS_INIT` can be used in C++ the same way that C uses it. Returning a struct directly isn't particularly "C-like" though.

What do you think?