Live data from Hacker News

A pure JavaScript implementation of Git for Node and browsers

github.com

71–80 of 203 posts

Re: A pure JavaScript implementation of Git for Node and browsers

#71
post #67

Earlier quoted context omitted.

IMO, this is because there's a general attitude about porting to Rust that porting to Rust, by itself, makes a material improvement in the quality of the software (e.g. reliability, performance, readability), and that these improvements that can't be achieved in C/C++. Entrenched C developers then rise to the debate to defend their language. This debate has happened often enough that any time someone ports something…

The only attack I feel is calling C/C++ a language. It's two languages and we don't like each other very much. People who spend a lot of time trying to write good C++ avoid much of C's bread and butter like malloc and free, and the general hatred of C++ from C developers is well-documented. I happen to prefer C++ to C and D to both.

I have never treated "C/C++" as the name of a single language. I always read it as "C and/or C++".

Re: A pure JavaScript implementation of Git for Node and browsers

#72

Looking at this rewrite I was wondering, but didn't find an answer in the project README: would emscripten successfully compile Git to js/wasm?

There's still a bit of bash hiding in the git commands if I remember correctly. That wouldn't be trivial to compile.

Re: A pure JavaScript implementation of Git for Node and browsers

#73
post #10

I think it's interesting how there's two phenomena that seem to be related to me that get posted here and seem to get treated with different responses. One the one hand, we have software originally written in C/C++ being rewritten in Rust (not often, sometimes just conceptualized), and there's often a real push back by some people about how it's a waste and not useful. On the other, we have software rewritten in Java…

Without being too reductive, a JS implementation of anything represents new possibilities (running in the web browser or other environments), whereas a rust port doesn't expand the surface area. To give a comparison, critiques of rust ports are similar to the critiques of porting everything to node.js a few years ago -- most of the benefit comes from rewriting and applying lessons learned from the existing implementa…

But Rust programs can run anywhere JS can now with web assembly, while the reverse isn't true. JS can only run where there is VM for it.

Re: A pure JavaScript implementation of Git for Node and browsers

#74
post #67

Earlier quoted context omitted.

IMO, this is because there's a general attitude about porting to Rust that porting to Rust, by itself, makes a material improvement in the quality of the software (e.g. reliability, performance, readability), and that these improvements that can't be achieved in C/C++. Entrenched C developers then rise to the debate to defend their language. This debate has happened often enough that any time someone ports something…

The only attack I feel is calling C/C++ a language. It's two languages and we don't like each other very much. People who spend a lot of time trying to write good C++ avoid much of C's bread and butter like malloc and free, and the general hatred of C++ from C developers is well-documented. I happen to prefer C++ to C and D to both.

> we don't like each other very much

Hi are you a language?

Re: A pure JavaScript implementation of Git for Node and browsers

#75

There's a pretty full functioning project from several years ago (seems actively maintained) that has similar goals here: https://github.com/creationix/js-git I think it was initially crowdfunded.

Used it, works great. Also really good to understand what git really "is".

Re: A pure JavaScript implementation of Git for Node and browsers

#76

Looking at this rewrite I was wondering, but didn't find an answer in the project README: would emscripten successfully compile Git to js/wasm?

There's still a bit of bash hiding in the git commands if I remember correctly. That wouldn't be trivial to compile.

I was going to write: "Simple, we just make a bash compiler", but I realized this might have already been done and to my horror a quick google search confirmed this, or more technically a sh to C transpiler: http://www.linux-magazine.com/Online/Features/SHC-Shell-Comp...

Re: A pure JavaScript implementation of Git for Node and browsers

#77
post #58

Earlier quoted context omitted.

It's really strange to me that nowadays source control seems to be, largely, a monoculture. Back in the day I either used, or knew plenty of people using any of CVS, Subversion, Sourcesafe, Sourcegear Vault, Perforce, AccuRev, ClearCase, along with a few others. Whilst distributed version control is a huge leap forward over many of those older systems, it's odd that nowadays it seems to be git or, well, nothing. I'm…

In Mercurial (circa 2016) Tags and branches were stored inside the repo itself, which meant you had to switch to the master branch to create a new branch or create a tag. If you created a tag in a branch the tag was visible only when you were in that branch. It caused numerous headaches trying to figure out why a tag didn't get pushed upstream. Git correctly treats this as metadata and stores it outside of the source…

Your description is correct for tags, a little off for branches.

You don't have to switch to master to create a branch, you have to switch to the branch you want to branch off of, which is the same as git. Also, all branches are visible and accessible from any branch/revision, unlike tags.

Re: A pure JavaScript implementation of Git for Node and browsers

#78
post #59
post #10

I think it's interesting how there's two phenomena that seem to be related to me that get posted here and seem to get treated with different responses. One the one hand, we have software originally written in C/C++ being rewritten in Rust (not often, sometimes just conceptualized), and there's often a real push back by some people about how it's a waste and not useful. On the other, we have software rewritten in Java…

Let's hope that the current "let's rewrite xxxyyyy in JavaScript" will soon be "let's rewrite it in webassembly". This makes much more sense to me.

You don't rewrite in wasm, you compile to it.

Re: A pure JavaScript implementation of Git for Node and browsers

#79
post #77
post #58

Earlier quoted context omitted.

In Mercurial (circa 2016) Tags and branches were stored inside the repo itself, which meant you had to switch to the master branch to create a new branch or create a tag. If you created a tag in a branch the tag was visible only when you were in that branch. It caused numerous headaches trying to figure out why a tag didn't get pushed upstream. Git correctly treats this as metadata and stores it outside of the source…

Your description is correct for tags, a little off for branches. You don't have to switch to master to create a branch, you have to switch to the branch you want to branch off of, which is the same as git. Also, all branches are visible and accessible from any branch/revision, unlike tags.

Git does default to the current HEAD, but it allows you to specify a start point if you want to. Doing this with git branch might be useful if you have changes you haven't committed and can't git stash for some reason.

See man git-branch and man git-checkout for details.

Re: A pure JavaScript implementation of Git for Node and browsers

#80

Looking at this rewrite I was wondering, but didn't find an answer in the project README: would emscripten successfully compile Git to js/wasm?

Git has its claws deep in the file system. On the browser side, JS and wasm have very limited access to the file system. You’d need to somehow bridge that gap. (It looks like isomorphic-git is using indexdb, and not the file system).

There’s probably other dependencies (ssh, http, an editor for commits) that need to be resolved to get expected functionality.

Post reply on HN