21

Which code and how much code do the original Git codebase and libgit2 have in common (from nothing to all Git functionality except of command line client entry points)?

I'm primarily interested in how "stable" libgit2 is and how easily and quickly bug-fixes and/or improvements from future development in the original Git codebase can be adopted by libgit2.

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
mstrap
  • 16,808
  • 10
  • 56
  • 86

2 Answers2

16

I believe currently they share no code. You might be interested in this thread on the main Git list¹ regarding a prospective "reimplementing" Git on top of libgit2 — with main Git maintainer (Junio C Hamano) chiming in.

In general, you might find these search results² interesting to inspect.


¹ The original link was pointing at GMANE's archive, but it's unfortunately down.

² The link to search results was this.

kostix
  • 51,517
  • 14
  • 93
  • 176
  • 3
    It's true that core git does not use libgit2, however there is core git code in libgit2; a number of authors have allowed their code (from git) to be relicensed under the libgit2 license (GPLv2 with a linking exception.) – Edward Thomson Jun 17 '13 at 19:14
  • @EdwardThomson as a very coarse estimate: would you say that `libgit2` is based on core git code or that it's more or less a rewrite from scratch? – mstrap Jun 17 '13 at 21:37
  • 4
    It's a rewrite. I haven't run a similarity metric to get real data, but I'd say less than 10% of the libgit2 code is ported from or copied directly from git. – Ben Straub Jun 17 '13 at 22:40
  • 1
    @mstrap, while Git itself does not (currently) use `libgit2`, a number of other projects do: "Github for Windows" uses it (and supposedly "Github for Mac" does this as well), `libgit2sharp` is beleived to be the standard way to use Git from C# etc. So while it's not a "blessed" way to access Git repositories, it appears to be rather popular and has all the good chances to gain the necessary momentum IMO. – kostix Jun 18 '13 at 09:48
  • @BenStraub I think this is the answer I'm looking for. – mstrap Jun 18 '13 at 12:37
  • @kostix Thanks for your opinion on this. I'm aware about these projects, but the fact that they are using `libgit2` that still would not give me enough confidence to build on top of `libgit2`. I agree that `libgit2` will most likely gain momentum and probably in one year this question might be obsolete. – mstrap Jun 18 '13 at 12:41
  • How can one be sure that if they download Git for Windows, for example, and use its commandline interface (CLI) to modify a Git repo (say, create branches; do some merges, etc.), that libgit2-based tools (such as Visual Studio 2015) will be 100% compatible with the changes made? I ask because Visual Studio now supposedly uses libgit2 behind the scenes. But you also can run Git for Windows and run that from a PowerShell prompt within Visual Studio. Is it dangerous to mix the two Git technology approaches??? It seems to me that it absolutely should be dangerous if not at least a little risky. – Jazimov May 09 '16 at 02:46
  • @ziggurism, yes, [gmane unfortunately gone down](https://news.ycombinator.com/item?id=12180547) and did not recovered fully yet. I think I was referring to [this thread](http://public-inbox.org/git/1267957655.3759.29.camel@mattotaupa/T/). – kostix Feb 16 '17 at 06:10
  • @Jazimov they both have continuous integration and big tests suites. Also libgit2 can probably directly use git tests on top of their own. Most of the matter is just ensuring any operation of libgit2 can't corrupt the repsository. Loosing data without corrupting the repository is actually hard because of the nature of git, which is loosely similar to blockchains. – ceztko Nov 17 '19 at 23:46
7

It currently shares no code and...

According to Russell Belfer:

When will core git be rewritten on top of libgit2...the answer is never. We serve different masters...

He lists some details to why in the talk that the quote was taken from: https://www.youtube.com/watch?v=4ZWqr6iih3s

hunterboerner
  • 1,264
  • 1
  • 11
  • 25