top | item 2747216

A git implementation in pure JavaScript

118 points| nephics | 14 years ago |github.com | reply

36 comments

order
[+] Nitramp|14 years ago|reply
The node.js JavaScript surge reminds me a bit of the early days of Java, where everyone went to implement whatever existed in C/C++ for Java. Only that this time people stick a ".js" in the end instead of a "J" in the front.

If history has a lesson, most of this will not be wildly successful, because the js environment is not suitable for the task to be an actual practical solution.

[+] justincormack|14 years ago|reply
Surely if that bit of history says anything then this will be successful? There is a big incentive for languages to reimplement natively, for Java it was cross platform consistency and security, for js in the browser it is complete unavailability of a native code API. (for node.js I am not really convinced though).

Sure there are some issues with js, eg binary support in browser is painful, and it is slow, but Java started off slow and lacking features too. It is improving.

Is now a good time to work on things like this? Why not. Especially if they feed into language and API improvements.

[+] deskamess|14 years ago|reply
Such efforts may not 'succeed' on the whole.

However there is great benefit to this young language when a popular utility can be implemented to highlight the weakness of a particular runtime implementation, or even the underlying language.

Git/Hg clients touch network io, file io, and rudimentary hashing in the normal execution path. So it makes for a good subject.

[+] lucraft|14 years ago|reply
OK, I was going to implement write support before posting it up here, but glad you guys like it.

There's tons more to do :)

[+] isntitvacant|14 years ago|reply
this looks really cool. i was actually working along the same lines (https://github.com/chrisdickinson/tempisfugit) to get a pure JS git implementation, though now I'm a little disconcerted since your project looks so fully featured :) One question: I noticed that you got dakongai's js-deflate library working with git -- I had tons of problems with getting it to read deflated git objects (mostly, that it wouldn't deflate them at all), and I had to turn to jxgcompressor (eventually) to get inflate to work. Before I saw this, I was planning on shimming in compression support by including a simple flash-to-js bridge; but if dakongai's library works I'd definitely rather use it. Again, awesome work!
[+] azakai|14 years ago|reply
Cool project!

Did you consider just compiling the C implementation into JavaScript? If so, I'm curious why you didn't go that route.

[+] dnewcome|14 years ago|reply
I thought about doing an in-browser git implementation for enabling offline mode in a webapp. Doing things with git would make some really interesting sync scenarios possible. Looking at what was involved though, I think I'm glad I didn't go down this particular rabbit-hole.
[+] cdcarter|14 years ago|reply
Another cool tool in this world is CouchDB. A local instance can replicate back and forth with a master when available, and you can serve an entire app right out of the DB.
[+] dropkick|14 years ago|reply
FYI, it only does reading but it's still very impressive. I've tried out the demo and it just works against small repos. It's very slow against larger ones.
[+] lucraft|14 years ago|reply
Yeah. I've thought of a few things to do about that. For instance, we could optimize a repo to have pack files that work well for the browser. [edit] also there's a load of optimization that can be done on the binary parsing. I haven't even started that yet.
[+] lucraft|14 years ago|reply
Did the "rake demo" work fine? Any problems figuring out what to do?
[+] tectonic|14 years ago|reply
Awesome, when this can do writing (presumably with an in-memory store for now), I think there will be some really interesting in-browser version control uses.
[+] mmahemoff|14 years ago|reply
Pure client-side wiki with version control, for one.
[+] nvictor|14 years ago|reply
what javascript testing library is it using?
[+] lurbina|14 years ago|reply
why?
[+] hvs|14 years ago|reply
I've never understood why this question is asked on Hacker News. Can you really not imagine why someone would try to do this, even as just an intellectual exercise?
[+] qF|14 years ago|reply
Because you can. I've made far more useless stuff simply because I felt it would be interesting or a challenge to make. Which in turn are usually the projects I learn the most from.
[+] mullr|14 years ago|reply
Because git is the distributed object database of our time, and JavaScript the ubiquitous execution environment. Useful, no?