3 # Helper functions for testing commit-graphs.
5 # Initialize OID cache with oid_version
11 graph_git_two_modes
() {
12 git
-c core.commitGraph
=true
$1 >output
&&
13 git
-c core.commitGraph
=false
$1 >expect
&&
14 test_cmp expect output
17 # graph_git_behavior <name> <directory> <branch> <compare>
19 # Ensures that a handful of traversal operations produce the same
20 # results with and without the commit-graph in use.
22 # NOTE: it is a bug to call this function with <directory> containing
23 # any characters in $IFS.
24 graph_git_behavior
() {
29 test_expect_success
"check normal git operations: $MSG" '
30 graph_git_two_modes "${DIR:+-C $DIR} log --oneline $BRANCH" &&
31 graph_git_two_modes "${DIR:+-C $DIR} log --topo-order $BRANCH" &&
32 graph_git_two_modes "${DIR:+-C $DIR} log --graph $COMPARE..$BRANCH" &&
33 graph_git_two_modes "${DIR:+-C $DIR} branch -vv" &&
34 graph_git_two_modes "${DIR:+-C $DIR} merge-base -a $BRANCH $COMPARE"
51 NUM_CHUNKS
=$
((3 + $
(echo "$2" |
wc -w)))
59 if test $GENERATION_VERSION -gt 1
61 OPTIONS
=" read_generation_data"
63 cat >"$DIR/expect" <<-EOF
64 header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
66 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
71 test-tool read-graph
>output
&&
72 test_cmp expect output