BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Git in JavaScript Kickstarter Project Funded in 28 Hours

Git in JavaScript Kickstarter Project Funded in 28 Hours

This item in japanese

Lire ce contenu en français

Tim Caswell, a well-known member of the JavaScript and Node.js communities, came up with the idea to reimplement Git in JavaScript and managed to get the project funded on Kickstarter within 28 hours with over 360 backers. The project is another example of Atwood's Law: "any application that can be written in JavaScript, will eventually be written in JavaScript."

InfoQ spoke to Tim to learn more about the project.

Where did the idea for JSGit come from?

I'm always looking for new ways to program the devices I own. I was recently sent a Surface RT by the nice people at Microsoft, had a couple iPads from a previous project and just bought a ChromeBook Pixel. They were interesting devices, but I was rather frustrated that they were so locked down and very hostile to development on the device. The one platform that nobody dares to lock down, not even Apple, is the JavaScript in the browser environment. You can generate and then execute code there, you can access local storage, and you can upload and download data on the internet.

After working on Cloud9 for a year, I realized that a browser-based IDE is possible today. The only problem that Cloud9 didn't solve well was the offline story. I wished that I could clone my Git repos locally to my device, work offline while flying overseas (or hanging out in the far end of my backyard), and then when I'm back within reach of internet, pushing my changes back to my public Git repo.

Since JavaScript was the one platform that was available everywhere, I decided I really wanted to have Git ported to it.

What do you see as use-cases for JSGit, is it just browser-based IDEs and editors or are there more broad applications?

My primary use case is browser-based programming environments, but many people have expressed interest in other uses, such as a pure JavaScript Git clients and servers for Node.js. Git is a common component in many deployment systems and having finer grained control of Git for Node.js servers and clients would be very useful to a lot of people.

Do you have any sense of what the performance will be like?

JavaScript itself is fairly fast, I recently wrote some very fast hash functions (MD5, SHA1, SHA256) in JavaScript and was able to get up to 500,000 MD5 hashes per second on my desktop browser. Since cloning a Git repo is slow even using the native client on a fast laptop for large repos, I don't expect this to handle that case well. But for small repos, I expect it to be plenty fast.

Why not take the approach of cross-compiling the existing C implementation of Git with something like Emscripten rather than reimplementing everything from scratch in JavaScript?

I plan to look into this, but from initial research into this area, there are two problems I foresee. First, Emscripten is a code generator. It generates fairly large code-bases and ends up being a direct port unless you manually tweak lots of code. Second, looking at the Git implementations in C they often are tightly coupled with the underlying filesystem and network calls. These would need heavy customization in a browser-based version of Git. I will need hand-written filesystem abstractions for the various web platforms since each has its own API for file storage.

There are implementations of Git in C, Java and other languages, what do you think will be the challenges in implementing it in JavaScript specifically?

I'm fairly experienced implementing crypto stuff in JavaScript, so I don't expect that to be a problem. But the sheer amount of code that needs implementing will be a problem. I plan on working in the bare essentials first and going up from there till I run out of time.

Why do this project now? Is there any particular HTML5 technology that makes this possible today?

It's more about hardware. There are more and more devices that have long battery life and great screens, but crappy development experiences.

Your project got funded in little over a day, what features do you expect to be able to build for the funds you will be receiving?

Like I estimated in my stretch goals, I hope to have the essential Git features implemented and if there is time, some integration with various platforms.

Why Kickstarter?

It sounded like a good idea at the time. So far it's working out, though after reading through all the Kickstarter rules, I'm feeling like this kind of project barely fits into their ideal for a project.

Do you think more (JavaScript) open source projects should try to get funding on Kickstarter?

I don't know yet, this is an experiment. I do like the idea of screening ideas for support before spending months of time working on them. I've spend hundreds of hours of my free time on past projects only to find out that there is little interest from the community for them. I really like the idea of working full-time on cool projects that people wish existed. I don't know if Kickstarter will work out long term, but I'll keep looking for other ideas if it doesn't.

JSGit is not the first JavaScript-related project to successfully reach its funding goal on Kickstarter. Previous projects include a book on asynchronous JavaScript programming and a screencast series on test-driven JavaScript. However, JSGit is the first Kickstarter project to produce a JavaScript library.

The project is open to pledges until March 30, 2013. Tim expects to start working on the project soon after the pledge deadline expires.

Rate this Article

Adoption
Style

BT