]> git.ipfire.org Git - thirdparty/git.git/commit - commit-graph.c
commit-graph: verify generation number
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 27 Jun 2018 13:24:39 +0000 (09:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Jun 2018 17:29:10 +0000 (10:29 -0700)
commit1373e547f7d38b9444fcaae16c1de698b719aa15
tree9a2737fc57a96ab50ed299018a49bee4ebbf1832
parent53614b13516ffd27bb045b696d0815b9da435cb0
commit-graph: verify generation number

While iterating through the commit parents, perform the generation
number calculation and compare against the value stored in the
commit-graph.

The tests demonstrate that having a different set of parents affects
the generation number calculation, and this value propagates to
descendants. Hence, we drop the single-line condition on the output.

Since Git will ship with the commit-graph feature without generation
numbers, we need to accept commit-graphs with all generation numbers
equal to zero. In this case, ignore the generation number calculation.

However, verify that we should never have a mix of zero and non-zero
generation numbers. Create a test that sets one commit to generation
zero and all following commits report a failure as they have non-zero
generation in a file that contains generation number zero.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-graph.c
t/t5318-commit-graph.sh