What a git SHA depends on? -


i wondering on parameters git sha depends on ? guessing there other parameters timestamp etc., besides content of commit, on construction of sha depends on.

i interested in such parameters on depends on. interested in situation when such parameters same, or enforced same resulting in same git sha of 2 commits made 2 persons on planet.

for commit, id depends on checksums of @ least...

  • the tree (all files , directories) id made of...
    • the content of files, not diff, called blob.
    • the directory tree (names of files , directories , how they're organized).
    • the permissions of files , directories.
  • the parent commit id(s).
  • the log message.
  • the committer name , email , date.
  • the author name , email date.

if change commit commit id changes.

including parent commit ids important. means 2 commits same content, built on different parents, still have different ids. why that? means if id of 2 commits same know entire history same. makes very efficient compare , update git repositories. "i have branch foo @ commit abc123, too? great, we're in sync!"


when comparing git other version control systems, remember in many popular "reliable" systems, subversion or cvs, file permissions can go in , undetectably change history in central repository. git such tampering detected because change downstream commit ids, or if brute force matched ids content complete nonsense.

the possibility of sha1 collision possibility has been considered. long story short, in conflict existing object wins.

the probability of sha1 collision happening accidentally vanishingly small, hope asteroid, cosmic ray, , wolf attack insurances paid up.

if 6.5 billion humans on earth programming, , every second, each 1 producing code equivalent of entire linux kernel history (3.6 million git objects) , pushing 1 enormous git repository, take 2 years until repository contained enough objects have 50% probability of single sha-1 object collision. higher probability exists every member of programming team attacked , killed wolves in unrelated incidents on same night.

seriously, there better things worry about, 1 in 100 chance of drive failure. how backups?


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -