Live data from Hacker News

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

gitlet.maryrosecook.com

1–10 of 78 posts

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

#5

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 mean, it just tells you the commit that last changed a line...

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

#6
post #5

Earlier quoted context omitted.

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

I mean, it just tells you the commit that last changed a line...

it's not that simple. git is a snapshot, i.e. it saves an entire file. How to recover changed lines from it efficiently? And How to do it for the entire history?

Basically, I want to understand this code

https://github.com/git/git/blob/master/blame.c

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

#8
In the 'real' Git, one of the functions I use frequently is `git checkout -- .`, which discards any unstaged changes. Looking at Gitlet's implementation, it wouldn't handle that well as `checkout` can only take a ref.

So I guess I'm wondering what the real `git checkout -- .` actually does behind the scenes?

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

#9

This is so cool, and also my first time seeing this brilliant format for long-form explanations of code. Is this a thing out there, and does anyone have any pointers on libraries that do this?

Backbone.js comes to mind: https://backbonejs.org/docs/backbone.html.

Edit: The author of backbone.js has a tool that generates documentation in this style. http://ashkenas.com/docco/

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

#10

This is so cool, and also my first time seeing this brilliant format for long-form explanations of code. Is this a thing out there, and does anyone have any pointers on libraries that do this?

It’s called literate programming, invented by Donald Knuth: https://en.m.wikipedia.org/wiki/Literate_programming
Post reply on HN