Live data from Hacker News

Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

gitlet.maryrosecook.com

31–40 of 78 posts

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#31

There is also Shit, a git implementation in an almost POSIX shell [0]. Not my software. [0]: https://git.sr.ht/~sircmpwn/shit

every time I look at these custom git repository I'm confused as to how I can read the code. For inept people like me it's here: https://git.sr.ht/~sircmpwn/shit/tree

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#32
post #22
post #11

Earlier quoted context omitted.

FWIW, since Git 2.23 I prefer using "git switch" and "git restore" instead of "git checkout".

This is correct, ‘git restore’ is the way to do this in the current version of git. ‘checkout —-‘ still works, but the ‘help’ text in ‘git status’ now recommends using ‘restore’. Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint. Really, It doesn’t make much sense to tack on some random ’--‘ flag on ‘checkout’ for that functionality. ‘restore’ is clear and describes…

> Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint.

It doesn’t since the feature can’t be removed from git checkout for BC reasons.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#33
post #12

Earlier quoted context omitted.

Something tells me I wouldn't want to work in whatever team you work with. git blame is extremely useful for knowing when something was added, and what the context was. It is not about "blaming" people for mistakes.

Yea, it strikes me as a poor name. Cheeky perhaps. I once had someone take me aside and ask me if it was rude to use "blame" in github to figure out who touched a specific line. They thought the name implied some sort of finger pointing and fault.

> Yea, it strikes me as a poor name.

Other VCS have aliases like « annotate » for the operation.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#34

this is cool! but I'm curious to see a git blame implementation.

You mean the most conflict driven and passive aggressive feature in any programming tooling?

I'm sorry if you had bad experiences with git blame usage. People can be assholes sometimes.

It's not meant to be a finger pointing tool but can be used for that.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#35
post #22

Earlier quoted context omitted.

This is correct, ‘git restore’ is the way to do this in the current version of git. ‘checkout —-‘ still works, but the ‘help’ text in ‘git status’ now recommends using ‘restore’. Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint. Really, It doesn’t make much sense to tack on some random ’--‘ flag on ‘checkout’ for that functionality. ‘restore’ is clear and describes…

> Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint. It doesn’t since the feature can’t be removed from git checkout for BC reasons.

It does, because it sounded like he was concerned with the complexity of explaining the broadness of uses for git checkout.

Now we can treat git restore like it is a separate thing.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#36
So, I'm going to put that out there, but I really wish I could read security-sensitive code like this. TLS implementations, cryptographic implementations, etc. It would be really amazing if there was a way for Github to automatically display code like this by extracting comments out.

In general I think it's an amazing way of learning, I remember reading the gobyexample.com website and writing the same thing for go assembly: https://davidwong.fr/goasm/add

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#37
post #36

So, I'm going to put that out there, but I really wish I could read security-sensitive code like this. TLS implementations, cryptographic implementations, etc. It would be really amazing if there was a way for Github to automatically display code like this by extracting comments out. In general I think it's an amazing way of learning, I remember reading the gobyexample.com website and writing the same thing for go as…

It's a very old idea. Donald Knuth implemented it with both Pascal and C to promote an idea of "literate programming" -- you'd literally just write prose sprinkled with little bits of programming. On compilation, you can choose to compile either the documentation or program.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#38
post #22
post #11

Earlier quoted context omitted.

FWIW, since Git 2.23 I prefer using "git switch" and "git restore" instead of "git checkout".

This is correct, ‘git restore’ is the way to do this in the current version of git. ‘checkout —-‘ still works, but the ‘help’ text in ‘git status’ now recommends using ‘restore’. Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint. Really, It doesn’t make much sense to tack on some random ’--‘ flag on ‘checkout’ for that functionality. ‘restore’ is clear and describes…

I have a Git alias for `rs = restore -SWs`. `git rs commit :` more-or-less mimics what `git checkout branch :` did. (BTW, : means "repository root, regardless of current .")

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#39
post #36

So, I'm going to put that out there, but I really wish I could read security-sensitive code like this. TLS implementations, cryptographic implementations, etc. It would be really amazing if there was a way for Github to automatically display code like this by extracting comments out. In general I think it's an amazing way of learning, I remember reading the gobyexample.com website and writing the same thing for go as…

As @chungy says in a sibling comment, this is what's known as a literate program. It never really took off, and I suspect it's partially because doing it well means you'll be writing a lot more text than you'd typically see in a program's comments.

See http://www.literateprogramming.com/ for more information and examples.

Re: Gitlet.js – Git implemented in 1k lines of JavaScript (2015)

#40
post #22
post #11

Earlier quoted context omitted.

FWIW, since Git 2.23 I prefer using "git switch" and "git restore" instead of "git checkout".

This is correct, ‘git restore’ is the way to do this in the current version of git. ‘checkout —-‘ still works, but the ‘help’ text in ‘git status’ now recommends using ‘restore’. Not only is it more semantic, it reduces the complexity of ‘git checkout’ which is a common complaint. Really, It doesn’t make much sense to tack on some random ’--‘ flag on ‘checkout’ for that functionality. ‘restore’ is clear and describes…

> ‘git restore’ is the way to do this in the current version of git.

No, that’s incorrect. `git checkout` is the way to do this in the current version of Git.

The current version of Git allows you to use `git restore`, but the documentation says this about it:

> THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

Until that warning goes away in a future version of Git, `git checkout` is the way to do this.

Post reply on HN