Is it possible to construct a cyclic git history like in the following ascii-art?
A (root)
| H<-G
| / \
VL \
C F
\ /
\ /
D->E
Where C is a merge commit of A and H, but H itself is a descendant of C
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Each commit ID is a SHA-1 hash of something that includes the commit IDs of its immediate ancestors, so ordinarily you’ll need to know the IDs of the ancestors before you can find an ID that can be their descendant. Thus there’s nowhere to start constructing a cycle.
Being able to construct a short cycle structure (where “short” means something like less than 2^64 commits in the cycle) would constitute a break of the hash function being used.
SHA-1 is known to be broken with regard to collision resistance, and it is conceivable that the techniques behind this break could adapted to construct a cycle. But it is not clear how to do this, and it is certainly not just a matter of plugging some off-the-shelf cryptanalytic components together.