MCPcopy Index your code
hub / github.com/git/git / write_table

Function write_table

t/unit-tests/u-reftable-readwrite.c:46–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static void write_table(char ***names, struct reftable_buf *buf, int N,
47 int block_size, enum reftable_hash hash_id)
48{
49 struct reftable_write_options opts = {
50 .block_size = block_size,
51 .hash_id = hash_id,
52 };
53 struct reftable_ref_record *refs;
54 struct reftable_log_record *logs;
55 int i;
56
57 REFTABLE_CALLOC_ARRAY(*names, N + 1);
58 cl_assert(*names != NULL);
59 REFTABLE_CALLOC_ARRAY(refs, N);
60 cl_assert(refs != NULL);
61 REFTABLE_CALLOC_ARRAY(logs, N);
62 cl_assert(logs != NULL);
63
64 for (i = 0; i < N; i++) {
65 refs[i].refname = (*names)[i] = xstrfmt("refs/heads/branch%02d", i);
66 refs[i].update_index = update_index;
67 refs[i].value_type = REFTABLE_REF_VAL1;
68 cl_reftable_set_hash(refs[i].value.val1, i,
69 REFTABLE_HASH_SHA1);
70 }
71
72 for (i = 0; i < N; i++) {
73 logs[i].refname = (*names)[i];
74 logs[i].update_index = update_index;
75 logs[i].value_type = REFTABLE_LOG_UPDATE;
76 cl_reftable_set_hash(logs[i].value.update.new_hash, i,
77 REFTABLE_HASH_SHA1);
78 logs[i].value.update.message = (char *) "message";
79 }
80
81 cl_reftable_write_to_buf(buf, refs, N, logs, N, &opts);
82
83 reftable_free(refs);
84 reftable_free(logs);
85}
86
87void test_reftable_readwrite__log_buffer_size(void)
88{

Calls 4

xstrfmtFunction · 0.85
cl_reftable_set_hashFunction · 0.85
cl_reftable_write_to_bufFunction · 0.85
reftable_freeFunction · 0.85