@@ -220,8 +220,9 @@ static int debug_ref_iterator_abort(struct ref_iterator *ref_iterator)
220220}
221221
222222static struct ref_iterator_vtable debug_ref_iterator_vtable = {
223- debug_ref_iterator_advance , debug_ref_iterator_peel ,
224- debug_ref_iterator_abort
223+ .advance = debug_ref_iterator_advance ,
224+ .peel = debug_ref_iterator_peel ,
225+ .abort = debug_ref_iterator_abort ,
225226};
226227
227228static struct ref_iterator *
@@ -261,6 +262,24 @@ static int debug_read_raw_ref(struct ref_store *ref_store, const char *refname,
261262 return res ;
262263}
263264
265+ static int debug_read_symbolic_ref (struct ref_store * ref_store , const char * refname ,
266+ struct strbuf * referent )
267+ {
268+ struct debug_ref_store * drefs = (struct debug_ref_store * )ref_store ;
269+ struct ref_store * refs = drefs -> refs ;
270+ int res ;
271+
272+ res = refs -> be -> read_symbolic_ref (refs , refname , referent );
273+ if (!res )
274+ trace_printf_key (& trace_refs , "read_symbolic_ref: %s: (%s)\n" ,
275+ refname , referent -> buf );
276+ else
277+ trace_printf_key (& trace_refs ,
278+ "read_symbolic_ref: %s: %d\n" , refname , res );
279+ return res ;
280+
281+ }
282+
264283static struct ref_iterator *
265284debug_reflog_iterator_begin (struct ref_store * ref_store )
266285{
@@ -418,30 +437,37 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
418437}
419438
420439struct ref_storage_be refs_be_debug = {
421- NULL ,
422- "debug" ,
423- NULL ,
424- debug_init_db ,
425- debug_transaction_prepare ,
426- debug_transaction_finish ,
427- debug_transaction_abort ,
428- debug_initial_transaction_commit ,
429-
430- debug_pack_refs ,
431- debug_create_symref ,
432- debug_delete_refs ,
433- debug_rename_ref ,
434- debug_copy_ref ,
435-
436- debug_ref_iterator_begin ,
437- debug_read_raw_ref ,
438- NULL ,
439-
440- debug_reflog_iterator_begin ,
441- debug_for_each_reflog_ent ,
442- debug_for_each_reflog_ent_reverse ,
443- debug_reflog_exists ,
444- debug_create_reflog ,
445- debug_delete_reflog ,
446- debug_reflog_expire ,
440+ .next = NULL ,
441+ .name = "debug" ,
442+ .init = NULL ,
443+ .init_db = debug_init_db ,
444+
445+ /*
446+ * None of these should be NULL. If the "files" backend (in
447+ * "struct ref_storage_be refs_be_files" in files-backend.c)
448+ * has a function we should also have a wrapper for it here.
449+ * Test the output with "GIT_TRACE_REFS=1".
450+ */
451+ .transaction_prepare = debug_transaction_prepare ,
452+ .transaction_finish = debug_transaction_finish ,
453+ .transaction_abort = debug_transaction_abort ,
454+ .initial_transaction_commit = debug_initial_transaction_commit ,
455+
456+ .pack_refs = debug_pack_refs ,
457+ .create_symref = debug_create_symref ,
458+ .delete_refs = debug_delete_refs ,
459+ .rename_ref = debug_rename_ref ,
460+ .copy_ref = debug_copy_ref ,
461+
462+ .iterator_begin = debug_ref_iterator_begin ,
463+ .read_raw_ref = debug_read_raw_ref ,
464+ .read_symbolic_ref = debug_read_symbolic_ref ,
465+
466+ .reflog_iterator_begin = debug_reflog_iterator_begin ,
467+ .for_each_reflog_ent = debug_for_each_reflog_ent ,
468+ .for_each_reflog_ent_reverse = debug_for_each_reflog_ent_reverse ,
469+ .reflog_exists = debug_reflog_exists ,
470+ .create_reflog = debug_create_reflog ,
471+ .delete_reflog = debug_delete_reflog ,
472+ .reflog_expire = debug_reflog_expire ,
447473};
0 commit comments