On Thu, 2009-03-05 at 07:36 +0100, stoecher@xxxxxx wrote: > Hi, > > being new to git I did some experiments with commits looking at the hashes. What I observed: > * The same commit (same file, same committer, same message) into different empty repositories (git init) gives different hashes. So I assume that also the time of the commit influences the hash. Is this intended? For what reason? > * Having created two repositories exactly the same way (the history is the same except for the commit times and hashes) I applied the same patch (using git am) and again I got different hashes for these commits. So in some way also the repository/branch influences the hash of a commit!? This should be expected if the initial hashes in the history are different. The hash of a commit is based also on the hashes of all parent commits - in this way git 'protects' the repository history by guaranteeing that if two objects have the same hash, they will come from the same history. So the second issue is a consequence of the first, though I am not certain why the first occurs (if the file contents and size are the same, I would expect the hash for the blob/tree to be the same - maybe due to git's special handling of initial commits?) > From reading the Git user's manual, chapter 10, object storage format, I was not expecting this. Can someone explain or give a link to a more detailed description? > > thank you, > > Wolfgang >
Attachment:
signature.asc
Description: This is a digitally signed message part