Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the non-incremental nature of tree objects. #1401

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions book/10-git-internals/sections/objects.asc
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ If you follow all the internal pointers, you get an object graph something like
.All the reachable objects in your Git directory.
image::images/data-model-3.png[All the reachable objects in your Git directory.]

To be clear clear, the tree object built for a commit references *all* of the files and directories visible at the commit
It does not only reference the content altered from the parent commit.
If the tree object for a commit fails to include a file that was present in its parent commit, that absence is interpreted as deletion of the file.

Comment on lines +347 to +350
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I like the intent here, there's definitely information that was left unspecified.

Let's reword a bit. How about this?

Suggested change
To be clear clear, the tree object built for a commit references *all* of the files and directories visible at the commit
It does not only reference the content altered from the parent commit.
If the tree object for a commit fails to include a file that was present in its parent commit, that absence is interpreted as deletion of the file.
To be clear, a commit's tree structure represents the complete contents of the working directory at that moment in time.
If the parent commit's tree includes a file that is not present in this commit's tree, that absence is interpreted as deletion of the file.

What do you think?

Copy link
Contributor

@ugultopu ugultopu Jan 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To be clear clear, the tree object built for a commit references *all* of the files and directories visible at the commit
It does not only reference the content altered from the parent commit.
If the tree object for a commit fails to include a file that was present in its parent commit, that absence is interpreted as deletion of the file.
To be clear, a commit's tree structure represents the complete contents of the staging area at that moment in time.
If the parent commit's tree includes a file that is not present in this commit's tree, that absence is interpreted as deletion of the file.

I thought a commit is a snapshot of the staging area (as opposed to the working directory). Please correct me if I'm wrong.

==== Object Storage

We mentioned earlier that there is a header stored with every object you commit to your Git object database.
Expand Down