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

Function test_reftable_stack__transaction_api

t/unit-tests/u-reftable-stack.c:249–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249void test_reftable_stack__transaction_api(void)
250{
251 char *dir = get_tmp_dir(__LINE__);
252 struct reftable_write_options opts = { 0 };
253 struct reftable_stack *st = NULL;
254 struct reftable_addition *add = NULL;
255
256 struct reftable_ref_record ref = {
257 .refname = (char *) "HEAD",
258 .update_index = 1,
259 .value_type = REFTABLE_REF_SYMREF,
260 .value.symref = (char *) "master",
261 };
262 struct reftable_ref_record dest = { 0 };
263
264 cl_assert_equal_i(reftable_new_stack(&st, dir, &opts), 0);
265
266 reftable_addition_destroy(add);
267
268 cl_assert_equal_i(reftable_stack_new_addition(&add, st, 0), 0);
269 cl_assert_equal_i(reftable_addition_add(add, write_test_ref,
270 &ref), 0);
271 cl_assert_equal_i(reftable_addition_commit(add), 0);
272
273 reftable_addition_destroy(add);
274
275 cl_assert_equal_i(reftable_stack_read_ref(st, ref.refname,
276 &dest), 0);
277 cl_assert_equal_i(REFTABLE_REF_SYMREF, dest.value_type);
278 cl_assert(reftable_ref_record_equal(&ref, &dest,
279 REFTABLE_HASH_SIZE_SHA1) != 0);
280
281 reftable_ref_record_release(&dest);
282 reftable_stack_destroy(st);
283 clear_dir(dir);
284}
285
286void test_reftable_stack__transaction_with_reload(void)
287{

Callers

nothing calls this directly

Calls 11

get_tmp_dirFunction · 0.85
reftable_new_stackFunction · 0.85
reftable_addition_addFunction · 0.85
reftable_addition_commitFunction · 0.85
reftable_stack_read_refFunction · 0.85
reftable_stack_destroyFunction · 0.85
clear_dirFunction · 0.85

Tested by

no test coverage detected