Re: linking libgit.a in C++ projects
From: cte <hidden>
Date: 2016-06-15 22:45:05
On Thu, Jul 31, 2008 at 11:27 AM, Sverre Rabbelier [off-list ref] wrote:
On Thu, Jul 31, 2008 at 13:10, cte [off-list ref] wrote:quoted
I'm not worried about the interfaces changing; the gui is tied to a particular version of git, and I will update the code that calls into libgit I pull new changes from the mainline into my local clone.You should be ;). Unless you are planning to learn a lot of C very fast, you should be worried about the interfaces changing. That is, if you want your GUI to be able to stay up to date with the current git version.
That is the plan.
quoted
who's to say that the output of the various commands won't change formats with future releases of git?Junio is to say. Plumbing output format is git's API.
Using output from the command line utilities as an API has its own set of problems. For instance, check out some of the difficulties that gitk and qgit have had to deal with: http://kerneltrap.org/mailarchive/git/2007/11/2/379067. Digging into the git internals and reusing its core functions will always be more powerful and flexible than parsing command line output. Of course, it is not always easy; git wasn't written to be easily compiled into a library and reused (graceful error handling and memory management are problematic). But I think the right thing to do is to work towards making the awesome git internals easier to use for other developers so great tools can continue to be built on top of git.
quoted
There is no correct solution if you are worried about forward compatibility, unless a well defined API is created (which would be sweet btw, but is probably not a priority).There is, use the plumbing, forward compatibility is 95% assured. With the exception of major releases, for which any plumbing output/behavior changes will be announced in the changelog, usually including an explanation on how to change your code to match.
95% assured != correct, IMO :)
In short, use the forc-... errr, plumbing ;). -- Cheers, Sverre Rabbelier