Re: Calculating tree nodes
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Sep 4, 2007, 02:51 UTC
- Message-ID
- <20070904025153.GS18160@spearce.org>
- In-Reply-To
- <9e4733910709031913q278cb9dbp441756afb28607c6@mail.gmail.com>
Jon Smirl <jonsmirl@gmail.com> wrote:
Show 6 quoted lines
> When I change a file it creates a new object with a new SHA. This new > SHA causes the tree node pointing to it to change. Changing the tree > node forces its parent to change and so on. Of course git batches all > of the changes together into a commit so that this ripple effect > doesn't happen for every file. But every commit causes a new root tree > node to be created, right?
Only if at least one file (or tree) differed. This may not be the case if you do a merge with the ours merge strategy, but these are very rare. So you can pretty much just say that yes, every commit causes a new root tree to be created.
Usually the smallest number of objects created per commit is 3:
- the new commit - the new root tree - the new blob for a file in the root directory
The number increases as more files are modified or if they are in subdirectories of the root.
-- Shawn.