Git Merge • A description of libgit2 (Ben Straub)


[Git Merge 2013] My name is Ben Straub. I work for GitHub. I work on a project called libgit2. We’ve heard this mentioned a couple times here today. I thought I’d come up here and give you guys a clue as to what the heck this thing is. Libgit2 is a C language re-implementation of the internals of git in a way that is friendly to access from other programs. Before libgit2 existed, the way that you would do this is just shelling out to git and parsing the textual output for that. And it’s not ideal. Let’s put it that way. There’s all kinds of problems. Git also has machine-readable formats that it can output. There’s a lot of support for this kind of a thing but
it’s still not ideal. Libgit2 tries to solve this problem. This is what it looks like when you use it from C. And if you’re not a C programmer don’t worry. This is just a super super basic example with very little error checking as you can kind of tell. But we also have lots of bindings. Because it’s written in C in such a way to make it easy for bindings to be written we’ve got bindings for just about every language you can think of including Go for you, Jack. The three on the top are probably the most mature bindings. The most complete. Just because we at GitHub use those. We use this for github.com. We use this for GitHub for Mac and GitHub for Windows. The Microsoft guys are building it into Visual Studio now. It’s used all over the place. I think tortoisegit uses libgit2. We’re getting lots and lots of users and clients that use this. It’s starting to get really really solid. If you wanna know more you wanna help us out here’s where to find us. And check it out! And I’ll be around! If you have any questions of any of us feel free to come up and ask I’d love to talk to you. Thanks! [Applause] Question? Yeah, go ahead! [audience member] Does it run on iOS? Does it run on iOS? Yes! The answer is yes. [a barely audible conversation between
audience member and another man] [second audience member] It does compile
with iOS but with all the [inaudible] It’s very hard to get [inaudible]. [1st AM] No, it doesn’t. – [2nd AM] It does compile–
– [1st AM] Aright [inaudible] [third audience member] [It calls
with] a raspberry pi. [Ben and some audience members laughing] For the recording, the question was “Does it run on iOS?” The answer is, “Yes, sort of.” It’s kind of hard to do something useful with the sandboxing that you’re under in iOS. But, yeah, you can do things with it. Yes. Yeah. [other audience member] The question is,
do you plan to make bindings for Java? I know there is a JGit project
but it is a bit different because it is different from
foundational git [inaudible]. [laughs] At this point I have nothing to announce. [laughter from the audience] If there were to be such a thing I would not be working on it. There may be somebody else in this room that is. I’m not sure. [yet another audience member]
We haven’t spoken about Java. [laughs] Did you want to talk about that? Or no? No? [sixth audience member] JGit [inaudible]. Alright. So I guess the main answer here is to use JGit. JGit’s pretty good. It would be possible to write JNI bindings for libgit2. I don’t know of a thing
that exists right now. [seventh audience member]
I think another part of the answer to that is that libgit2 is also another
[inaudible] to git. So there are three very
common [inaudible]. Anybody else? Alright. I will yield to the next speaker then. Thanks guys! [Git Merge 2013]

1 thought on “Git Merge • A description of libgit2 (Ben Straub)

Leave a Reply

Your email address will not be published. Required fields are marked *