Git refers to the user-friendly commands as “porcelain” Ahhhhahahaha… “user friendly”. When compared to coding the repo by hand, I guess.
Artisanal handcrafted Git repositories
41–50 of 74 posts
Re: Artisanal handcrafted Git repositories
#42Neat to see this done by hand! It helps demystify the magic behind git commands. If you like this, I also recommend "Write Yourself a Git", where you build a minimal git implementation using python: https://wyag.thb.lt/
Re: Artisanal handcrafted Git repositories
#43My recent horror from some git work was discovering how git sorts its tree objects. The docs just say to sort by C locale (byte-order sorting). Easy. Except git was sometimes rejecting my packfiles as being bogus per its fsck code, saying my trees were misordered. TURNS OUT THERE'S AN UNDOCUMENTED RULE: you need to append an implicit forward slash to directory tree entry names before you sort them. That forward slash…
Re: Artisanal handcrafted Git repositories
#44My recent horror from some git work was discovering how git sorts its tree objects. The docs just say to sort by C locale (byte-order sorting). Easy. Except git was sometimes rejecting my packfiles as being bogus per its fsck code, saying my trees were misordered. TURNS OUT THERE'S AN UNDOCUMENTED RULE: you need to append an implicit forward slash to directory tree entry names before you sort them. That forward slash…
But... git doesn't really store directories, does it?
Re: Artisanal handcrafted Git repositories
#45My recent horror from some git work was discovering how git sorts its tree objects. The docs just say to sort by C locale (byte-order sorting). Easy. Except git was sometimes rejecting my packfiles as being bogus per its fsck code, saying my trees were misordered. TURNS OUT THERE'S AN UNDOCUMENTED RULE: you need to append an implicit forward slash to directory tree entry names before you sort them. That forward slash…
> directory tree entry names But... git doesn't really store directories, does it?
Turns out that Git does somewhat store dirs (in form of trees). See https://git-scm.com/book/en/v2/Git-Internals-Git-Objects (section "Tree Objects").
To understand op's repro look at the last two lines (objects in the tree) in each of their command outputs, not the files shown in the first few lines.
What I think op means is that the `testing` tree pointed in their first example is sorted after `testing.md` even though it's only called `testing` because it's being sorted as `testing/` and `/` is > `.` bytewise.
I'm not at a computer right now but it would be nice to test it with files named `testing.` and `testing0` since they are adjacent bytewise and would show the implicit forward slash more clearly with the tree object sitting between them.
This makes me wonder why Git can't just store an empty tree for empty dirs.
EDIT: did the Gist https://gist.github.com/alvaro-cuesta/bd0234e3e1a66819c7e9e9...
Notice the `git cat-file -p HEAD^{tree}` outputs.
Re: Artisanal handcrafted Git repositories
#46My recent horror from some git work was discovering how git sorts its tree objects. The docs just say to sort by C locale (byte-order sorting). Easy. Except git was sometimes rejecting my packfiles as being bogus per its fsck code, saying my trees were misordered. TURNS OUT THERE'S AN UNDOCUMENTED RULE: you need to append an implicit forward slash to directory tree entry names before you sort them. That forward slash…
The way I found out was that Github kept rejecting my push, because as I later discovered, my git history was invalid precisely due to entries being sorted improperly due to the forward slash requirement. I could have solved this with the real git, but the point was to use my tool exclusively for version control from inception, so I just deleted the .git folder. So, my git history appears to begin near the end of the whole cycle. But I did manage to learn a lot, both about git and about the language I implemented it in.
Re: Artisanal handcrafted Git repositories
#47My recent horror from some git work was discovering how git sorts its tree objects. The docs just say to sort by C locale (byte-order sorting). Easy. Except git was sometimes rejecting my packfiles as being bogus per its fsck code, saying my trees were misordered. TURNS OUT THERE'S AN UNDOCUMENTED RULE: you need to append an implicit forward slash to directory tree entry names before you sort them. That forward slash…
> directory tree entry names But... git doesn't really store directories, does it?
Re: Artisanal handcrafted Git repositories
#48Re: Artisanal handcrafted Git repositories
#49Re: Artisanal handcrafted Git repositories
#50Git refers to the user-friendly commands as “porcelain” Ahhhhahahaha… “user friendly”. When compared to coding the repo by hand, I guess.