Sharan,

You have it in one. 

Yes that is the reason that git computes the sha1 of the file's contents - it 
provides integrity, veracity and non-repudiation (the last one is still true 
though cryo-analysis is getting better, so sha1 is no longer recommended, and 
Git is looking at how to progress to newer crypto-hashes).
Once Git has the sha1's of the files in a directory, it does the same again for 
the 'file' that lists the file names, mode bits and their content's sha1s, and 
ever onwards up the trees to the commit, which lists the sha1s of its parents.

So it you have the sha1 of the tip of a branch, such as master, and you have a 
repo that holds that sha1, then you have the full crypto integrity that your 
copy (with all its history) is identical to that of the originators - your own 
Dali, Rembrant, Gogin, hanging in your hall... and it isn't even a replica, 
it's the real thing!

Philip

It's turtles all the way down.

  ----- Original Message ----- 
  From: Sharan Basappa 
  To: Git for human beings 
  Sent: Sunday, August 07, 2016 5:26 PM
  Subject: [git-users] SHA-1 checksum


  Hi,


  I would like to know why GIT calculates checksum of a file.
  Typically, checksum is used for the purpose of integrity.


  An example would really help.


  Regards,

  -- 
  You received this message because you are subscribed to the Google Groups 
"Git for human beings" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to git-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to