Skip to content

Commit c78c7a9

Browse files
derrickstoleegitster
authored andcommitted
test-read-graph: include extra post-parse info
It can be helpful to verify that the 'struct commit_graph' that results from parsing a commit-graph is correctly structured. The existence of different chunks is not enough to verify that all of the optional features are correctly enabled. Update 'test-tool read-graph' to output an "options:" line that includes information for different parts of the struct commit_graph. In particular, this change demonstrates that the read_generation_data option is never being enabled, which will be fixed in a later change. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c53a8c commit c78c7a9

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

t/helper/test-read-graph.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "commit-graph.h"
44
#include "repository.h"
55
#include "object-store.h"
6+
#include "bloom.h"
67

78
int cmd__read_graph(int argc, const char **argv)
89
{
@@ -45,6 +46,18 @@ int cmd__read_graph(int argc, const char **argv)
4546
printf(" bloom_data");
4647
printf("\n");
4748

49+
printf("options:");
50+
if (graph->bloom_filter_settings)
51+
printf(" bloom(%"PRIu32",%"PRIu32",%"PRIu32")",
52+
graph->bloom_filter_settings->hash_version,
53+
graph->bloom_filter_settings->bits_per_entry,
54+
graph->bloom_filter_settings->num_hashes);
55+
if (graph->read_generation_data)
56+
printf(" read_generation_data");
57+
if (graph->topo_levels)
58+
printf(" topo_levels");
59+
printf("\n");
60+
4861
UNLEAK(graph);
4962

5063
return 0;

t/t4216-log-bloom.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ graph_read_expect () {
4848
header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
4949
num_commits: $1
5050
chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data
51+
options: bloom(1,10,7)
5152
EOF
5253
test-tool read-graph >actual &&
5354
test_cmp expect actual

t/t5318-commit-graph.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ graph_read_expect() {
104104
header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
105105
num_commits: $1
106106
chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
107+
options:
107108
EOF
108109
test-tool read-graph >output &&
109110
test_cmp expect output

t/t5324-split-commit-graph.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ graph_read_expect() {
3434
header: 43475048 1 $(test_oid oid_version) 4 $NUM_BASE
3535
num_commits: $1
3636
chunks: oid_fanout oid_lookup commit_metadata generation_data
37+
options:
3738
EOF
3839
test-tool read-graph >output &&
3940
test_cmp expect output
@@ -508,6 +509,7 @@ test_expect_success 'setup repo for mixed generation commit-graph-chain' '
508509
header: 43475048 1 $(test_oid oid_version) 4 1
509510
num_commits: $NUM_SECOND_LAYER_COMMITS
510511
chunks: oid_fanout oid_lookup commit_metadata
512+
options:
511513
EOF
512514
test_cmp expect output &&
513515
git commit-graph verify &&
@@ -540,6 +542,7 @@ test_expect_success 'do not write generation data chunk if not present on existi
540542
header: 43475048 1 $(test_oid oid_version) 4 2
541543
num_commits: $NUM_THIRD_LAYER_COMMITS
542544
chunks: oid_fanout oid_lookup commit_metadata
545+
options:
543546
EOF
544547
test_cmp expect output &&
545548
git commit-graph verify
@@ -581,6 +584,7 @@ test_expect_success 'do not write generation data chunk if the topmost remaining
581584
header: 43475048 1 $(test_oid oid_version) 4 2
582585
num_commits: $(($NUM_THIRD_LAYER_COMMITS + $NUM_FOURTH_LAYER_COMMITS))
583586
chunks: oid_fanout oid_lookup commit_metadata
587+
options:
584588
EOF
585589
test_cmp expect output &&
586590
git commit-graph verify
@@ -620,6 +624,7 @@ test_expect_success 'write generation data chunk if topmost remaining layer has
620624
header: 43475048 1 $(test_oid oid_version) 5 1
621625
num_commits: $(($NUM_SECOND_LAYER_COMMITS + $NUM_THIRD_LAYER_COMMITS + $NUM_FOURTH_LAYER_COMMITS + $NUM_FIFTH_LAYER_COMMITS))
622626
chunks: oid_fanout oid_lookup commit_metadata generation_data
627+
options:
623628
EOF
624629
test_cmp expect output
625630
)

0 commit comments

Comments
 (0)