3 ms·
Very good read. I was just hacking around with a tiny Python program that implemented enough to init, add, commit, and push itself to GitHub. It's all very simp
by benhoyt 10y ago
Very good read. I was just hacking around with a tiny Python program that implemented enough to init, add, commit, and push itself to GitHub. It's all very simple until you get to the index format ... which isn't that bad, but it's definitely more complicated than this article makes out.
She refers to .git/index as a text file where "each line of the file maps a tracked file to the hash of its content". However, .git/index is actually a binary file where each entry is a bunch of different fields like creation time and modify time and SHA-1 encoded in binary. See https://github.com/git/git/blob/master/Documentation/technical/index-format.txt https://github.com/git/git/blob/master/Documentation/technic...
So I wasn't sure whether this part of the article was simply wrong, or whether git index format "version 1" was text, or something else?
- benhoyt 10y agoFor future reference: I asked Mary (the author) about this and she said, "Great point! As far as structure of the data, the file may as well be a text file of lines of information. I decided to omit talk about how git actually stores data to focus on the structural concepts. Maybe I should have included a bullet point. I don't actually control the version of the article that was posted on HN. but I'll certainly update the version on my website."