@@ -530,13 +530,14 @@ static int fsck_handle_reflog(const char *logname, void *cb_data)
530530 return 0 ;
531531}
532532
533- static int fsck_handle_ref (const struct reference * ref , void * cb_data UNUSED )
533+ static int fsck_handle_ref (const char * refname , const char * referent UNUSED , const struct object_id * oid ,
534+ int flag UNUSED , void * cb_data UNUSED )
534535{
535536 struct object * obj ;
536537
537- obj = parse_object (the_repository , ref -> oid );
538+ obj = parse_object (the_repository , oid );
538539 if (!obj ) {
539- if (is_promisor_object (the_repository , ref -> oid )) {
540+ if (is_promisor_object (the_repository , oid )) {
540541 /*
541542 * Increment default_refs anyway, because this is a
542543 * valid ref.
@@ -545,19 +546,19 @@ static int fsck_handle_ref(const struct reference *ref, void *cb_data UNUSED)
545546 return 0 ;
546547 }
547548 error (_ ("%s: invalid sha1 pointer %s" ),
548- ref -> name , oid_to_hex (ref -> oid ));
549+ refname , oid_to_hex (oid ));
549550 errors_found |= ERROR_REACHABLE ;
550551 /* We'll continue with the rest despite the error.. */
551552 return 0 ;
552553 }
553- if (obj -> type != OBJ_COMMIT && is_branch (ref -> name )) {
554- error (_ ("%s: not a commit" ), ref -> name );
554+ if (obj -> type != OBJ_COMMIT && is_branch (refname )) {
555+ error (_ ("%s: not a commit" ), refname );
555556 errors_found |= ERROR_REFS ;
556557 }
557558 default_refs ++ ;
558559 obj -> flags |= USED ;
559560 fsck_put_object_name (& fsck_walk_options ,
560- ref -> oid , "%s" , ref -> name );
561+ oid , "%s" , refname );
561562 mark_object_reachable (obj );
562563
563564 return 0 ;
@@ -579,19 +580,13 @@ static void get_default_heads(void)
579580 worktrees = get_worktrees ();
580581 for (p = worktrees ; * p ; p ++ ) {
581582 struct worktree * wt = * p ;
582- struct strbuf refname = STRBUF_INIT ;
583+ struct strbuf ref = STRBUF_INIT ;
583584
584- strbuf_worktree_ref (wt , & refname , "HEAD" );
585- fsck_head_link (refname .buf , & head_points_at , & head_oid );
586- if (head_points_at && !is_null_oid (& head_oid )) {
587- struct reference ref = {
588- .name = refname .buf ,
589- .oid = & head_oid ,
590- };
591-
592- fsck_handle_ref (& ref , NULL );
593- }
594- strbuf_release (& refname );
585+ strbuf_worktree_ref (wt , & ref , "HEAD" );
586+ fsck_head_link (ref .buf , & head_points_at , & head_oid );
587+ if (head_points_at && !is_null_oid (& head_oid ))
588+ fsck_handle_ref (ref .buf , NULL , & head_oid , 0 , NULL );
589+ strbuf_release (& ref );
595590
596591 if (include_reflogs )
597592 refs_for_each_reflog (get_worktree_ref_store (wt ),
0 commit comments