Re: VCS comparison table
- From
- Vincent Ladeuil <v.ladeuil@alplog.fr>
- Date
- Oct 26, 2006, 10:52 UTC
- Message-ID
- <877iyne4dm.fsf@alplog.fr>
- In-Reply-To
- <20061026101038.GA13310@coredump.intra.peff.net>
>>>>> "Jeff" == Jeff King <peff@peff.net> writes:
Jeff> On Thu, Oct 26, 2006 at 05:57:20PM +0800, James Henstridge wrote:
>> >If you two have the same commit that is a guarantee that you two
>> >have identical trees. The reverse is not true as logic 101
>> >would teach ;-).
>>
>> That was the point I was trying to make. Carl asserted that in git
>> you could tell if you had the same tree as someone else based on
>> revision IDs, which doesn't seem to be the case all the time. Jeff> If you have the same revision (commit IDs), you have
Jeff> the same tree (at the same time, by the same committer,
Jeff> etc). Jeff> If you have a different revision (commit), you may or
Jeff> may not have the same tree. You can then check the tree
Jeff> id, which will either be the same (you have the same
Jeff> tree) or differ (you don't). Jeff> Thus, in the converse, if you have the same tree, you
Jeff> _will_ have the same tree id. You may or may not have
Jeff> the same commit id.Ok, so git make a distinction between the commit (code created by someone) and the tree (code only).
Commits are defined by their parents.
Trees are defined by their content only ?
If that's the case, how do you proceed ?
Calculate a sha1 representing the content (or the content of the diff from parent) of all the files and dirs in the tree ? Or from the sha1s of the files and dirs themselves recursively based on sha1s of the files and dirs they contain ?
I ask because the later seems to provide some nice effects similar to what makes BDD (http://en.wikipedia.org/wiki/Binary_decision_diagram) so efficient: you can compare graphs of any complexity or size in O(1) by just comparing their signatures.
Vincent