I think I'm missing something. I had the impression that using the SHA-1 git hash code identifier meant that you can be sure that the patch received from someone else for this commit has not been changed.
Take this test that I did on my machine (obviously the name and email address):
cd dogcatcher dogcatcher> git log commit 926f347567a9da6f7692aca0e23d13f094d9e3a6 Author: Joe User < joe@test.com > Date: Sat Dec 17 15:28:55 2011 -0600 3rd branch commit commit 11e8055aa5e8f0d323c48b4f691adced7a8a9762 Author: Joe User < joe@test.com > Date: Sat Dec 17 15:10:44 2011 -0600 second branch commit commit 23deb7093a8565479092ef84142a0e2e7282d213 Author: Joe User < joe@test.com > dogcatcher> git format-patch 23de (format a patch containing everything since 23de) dogcatcher> cd .. ~> cp -r dogcatcher catcatcher cd catcatcher catcatcher> git reset --hard 23de (reset HEAD to 23de) catcatcher> git am 00* (apply the two patch files) catcatcher> git log commit 2548980811d1875971ce1a018df98374950e0059 Author: Joe User < joe@test.com > Date: Sat Dec 17 15:28:55 2011 -0600 3rd branch commit commit 7d651d05344ba6e2cd18d8e24c0c350d0c7dec66 Author: Joe User < joe@test.com > Date: Sat Dec 17 15:10:44 2011 -0600 second branch commit commit 23deb7093a8565479092ef84142a0e2e7282d213 Author: Joe User < joe@test.com >
As you can see, the hashes are different from the last two commits that were created by the patch. Now maybe that makes sense. Of course, the timestamps of the files created by the patch were different. (I'm not sure which set of information is included in the hash)
However, if so, how can I verify that the fixes I just applied contain exactly the same code? How do I know that the person who sent me the patch files did not make vile changes?
Or did I make a mistake that caused another hash, and if I did it right, would I exit with the same hash?
source share