4 ms·
How many languages is Git actually written in? I had the impression that it was just C. What is each language used for?
by jackowayed 15y ago
How many languages is Git actually written in? I had the impression that it was just C. What is each language used for?
- ptn 15y agoThere's bash in there, and I think there's some Python; some plugins (git-svn) are in Perl. I also wasn't under the impression that there were 10 languages there.
- stock_toaster 15y agoI believe python is required only for building the docs (html/man) as they are written in asciidoc. There are precompiled docs (git-manpages / git-htmlpages) in the kernel.org git dir[1], so most often that isn't needed. [1]: http://www.kernel.org/pub/software/scm/git/ http://www.kernel.org/pub/software/scm/git/ edit: Looks like there are a few importers written in python as well, but those are entirely optional.
- jakevoytko 15y agoGit's core is C. This has the packfile and object store code, the diffing and patching code, reflog code, generic commit-walking libraries, etc. I read it a few years ago when making a Git packfile reader, and the C code is very understandable. I grokked it much quicker than HG's core, the only other one I read. Most of Git's functionality is built with scripts. Lots of jobs, like octopus merging, are done in Bash scripts that dispatch all of the real work to the C libraries. The Git source distribution has a contrib section that has Python, elisp, and Perl (among others). It also includes a few subprojects like Gitweb, each done in random languages. All of this causes the overall source tree feel very unorganized.
- js2 15y agoAs of 1.7.5.2, git-core is 119 binaries, 29 shell scripts, 9 perl scripts, and 1 python script. The intention is to eventually replace the remaining shell scripts with C. Perl is used for add-interactive, most of the import/export functionality (arch, cvs, svn), gitweb, and the send-email script. Python is a relatively recent addition, and is being used for the so-called remote helpers, which will eventually allow git to push/pull changes from non-git servers. TCL is used for gitk only.
- ciupicri 15y agosloccount says the following for the master branch (391b142): Totals grouped by language (dominant language first): ansic: 122029 (46.81%) sh: 88481 (33.94%) perl: 23931 (9.18%) tcl: 20351 (7.81%) python: 4021 (1.54%) lisp: 1785 (0.68%) asm: 98 (0.04%) Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
- zedshaw 15y agoThat just makes me cry. Absolutely no sense of style, just a bunch of obscene hacks that only work because a billion people use it.
- deleted 15y ago[deleted]
- beagle3 15y ago... and you have just described the state of almost every single successful product and industry.
- zedshaw 15y agoYou must be using a lot of crap then.
- enko 15y agoI guess everyone is using a lot of crap then, and they're all completely wrong and you're right. This is possible, of course, but instead of snarky dismissals you could perhaps say why you think what you do. I respect you, but also happen to think git kicks ass, a few minor warts notwithstanding. Your dismissive appraisal as "crap" is basically worthless.
- beagle3 15y agoSo do you: x86 architecture, HTTP, Microsoft Windows, Adobe Flash, Water based urinals, internal combustion engine based cars, the modern English language, mobile phones. All of these disappear into the background once you get used to them - until they get replaced by something better or worse (to the point that you can't find the previous one) - and then they are visible again, either with an appreciative or nostalgic look, but only for a short while. Case in point for improvement - almost all pre-iphone phones are clunky (by today's standards), and almost all post-iphone touch screen phones are copies of the iphone. The clunky phones were just as clunky in 2005, but until the world was aware of the alternative, it wasn't obvious _how_ clunky and style free they are. Case in point for degradation - my 1280x1024 17" 4:3 matte LCD monitor that I got in 2005 still looks brilliant and useful on my desk - and I have a working 2001 17" CRT monitor that can do 1600x1200 without blurring or breaking a sweat. Both were not the cheapest available at the time I bought them, but were far from high end. I was recently looking for a replacement and can't find a freaking 4:3 LCD monitor; and all the 16:9 ones are glossy, 17" don't go above ~800 horizontal lines. Where's the style in that? And zed - since you like programming languages like Python and Lua (which both have a very well defined style) - you might like K (commercial version at kx.com ; open at https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona ) it's the ultimate stylish language. (And you can't look at software engineering seriously again after you've mastered it - everything looks so convoluted and unneeded. Think R on steroids, to the point that plain R seems as verbose as Ada)