Thread (7 messages) flat view 7 messages, 6 authors, 2016-06-15

Re: Git commit hash clash prevention

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:45:26

Hi,

On Thu, 2 Oct 2008, martin f krafft wrote:
the other day during a workshop on Git, one of the attendants asked 
about the scenario when two developers, Jane and David, both working on 
the same project, both create a commit and the two just so happen to 
have the same SHA-1. I realise that the likelihood of this happening is 
about as high as the chance of <insert witty joke here>, but it *is* 
possible, isn't it? Even though this is thus somewhat academic, I am 
still very curious about it.
It _is_ academic.  Did you already discuss the chance that your wife gives 
birth to a mouse?  I haven't done the maths yet, but I am pretty certain 
that this would be more likely than an unintended SHA-1 collision.
What happens when David now pulls from Jane? How does Git deal with 
this?
Basically, the commit that David has will not be overwritten.  So every 
commit referring to Jane's commit would point to David's in his 
repository.

But the more likely case (well, as likely goes) would be that either 
Jane's or David's object is actually a blob.  And Git would complain about 
a type mismatch then.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help