Git Internals only `cat-file -p` the initial commit, so fails to list any parents
In https://github.com/progit/progit2/blob/master/book/10-git-internals/sections/objects.asc, the section on "Commit Objects", only gives one example of the commit's internals, that of the initial commit (with no parents)
$ git cat-file -p fdf4fc3
tree d8329fc1cc938780ffdd9f94e0d364e0ea74f579
author Scott Chacon <[email protected]> 1243040974 -0700
committer Scott Chacon <[email protected]> 1243040974 -0700
first commit
The examples should include the content for a regular commit, with a parent, and a merge commit with multiple parents.
Such an example would show where the parent line is inserted within the internal format, which can't be discerned by the current example.
As an aside, there's no indication of the effect of having the {40}0 root commit as say a second parent given that normally the initial commit does not list any parents rather than a zero commit.
That’s actually a great idea. Want to submit a PR that fixes this? I’d love for you to get credit for the fix.
It's on the long todo list ;-)
-
it came about because of following up a promise to improve the --preserve-merges warning comment
-
which follows from GfW needing to continuously rebase on top of uspstream Git without loosing the old series...
so hopefully, soon.
@ben Also, is there a source for the scripts that generate those examples? Or do I have to recreate them all?
(just wondering as I'm part way through a tedious copy paste, and have worries that there are some date/time and other config values that may be missing from the examples, which would mean that the commit sha1/oids can't be reproduced..)
If there is no source for the script examples, maybe https://github.com/progit/progit2/tree/master/script is a place to store them?
If there is no source for the script examples, maybe /script@master is a place to store them?
That's actually a pretty cool idea. There isn't currently a script, all of the input and output you see is manually generated and then manually cleaned up for the book. Many of the SHAs you'll see depend on the specific date that commits were made too, so re-running the commands today will have different output.