3 ms·
I could be crazy, but aren't the hashes the diffs of checkins? It's certainly possible to create a valid patch file that causes a collision, but it seems reall
by jfoutz 10y ago
I could be crazy, but aren't the hashes the diffs of checkins?
It's certainly possible to create a valid patch file that causes a collision, but it seems really hard to make a collision that looks like a valid pull request.
I understand your concern (I think) but consider all the extra stuff that has to happen for someone to accept a pr.
Edit.
I do agree it's time to start thinking about moving to the fire exits
- RichardCA 10y agoNo, that's not how Git works. There are multiple objects in Git that use SHA-1 for identification. A common point of confusion is when someone thinks a commit is essentially a diff. It's not, each commit is a snapshot that can be used to reconstruct the entire work tree. You get the diff when you compare the commit to its parent. Here, this is a good read: https://github.com/git/git/commit/e83c5163316f89bfbde7d9ab23ca2e25604af290 https://github.com/git/git/commit/e83c5163316f89bfbde7d9ab23...
- kpcyrd 10y agoNo, the commit hash is a hash of the commit object, which holds a hash of the tree object, which holds hashes of the file objects.
- grandalf 10y agoAs long as the first part of the diff shown appeared not to be abnormal, some users might be fooled. For example, a file could be created that appears to be a normal source file at the front but contains some other behavior further down.