@@ -755,7 +755,7 @@ void wt_status_collect(struct wt_status *s)
755755 wt_status_collect_changes_index (s );
756756 wt_status_collect_untracked (s );
757757
758- wt_status_get_state (& s -> state , s -> branch && !strcmp (s -> branch , "HEAD" ));
758+ wt_status_get_state (s -> repo , & s -> state , s -> branch && !strcmp (s -> branch , "HEAD" ));
759759 if (s -> state .merge_in_progress && !has_unmerged (s ))
760760 s -> committable = 1 ;
761761}
@@ -1482,7 +1482,8 @@ static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
14821482 return 1 ;
14831483}
14841484
1485- static void wt_status_get_detached_from (struct wt_status_state * state )
1485+ static void wt_status_get_detached_from (struct repository * r ,
1486+ struct wt_status_state * state )
14861487{
14871488 struct grab_1st_switch_cbdata cb ;
14881489 struct commit * commit ;
@@ -1499,7 +1500,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
14991500 /* sha1 is a commit? match without further lookup */
15001501 (oideq (& cb .noid , & oid ) ||
15011502 /* perhaps sha1 is a tag, try to dereference to a commit */
1502- ((commit = lookup_commit_reference_gently (the_repository , & oid , 1 )) != NULL &&
1503+ ((commit = lookup_commit_reference_gently (r , & oid , 1 )) != NULL &&
15031504 oideq (& cb .noid , & commit -> object .oid )))) {
15041505 const char * from = ref ;
15051506 if (!skip_prefix (from , "refs/tags/" , & from ))
@@ -1556,30 +1557,31 @@ int wt_status_check_bisect(const struct worktree *wt,
15561557 return 0 ;
15571558}
15581559
1559- void wt_status_get_state (struct wt_status_state * state ,
1560+ void wt_status_get_state (struct repository * r ,
1561+ struct wt_status_state * state ,
15601562 int get_detached_from )
15611563{
15621564 struct stat st ;
15631565 struct object_id oid ;
15641566
1565- if (!stat (git_path_merge_head (the_repository ), & st )) {
1567+ if (!stat (git_path_merge_head (r ), & st )) {
15661568 state -> merge_in_progress = 1 ;
15671569 } else if (wt_status_check_rebase (NULL , state )) {
15681570 ; /* all set */
1569- } else if (!stat (git_path_cherry_pick_head (the_repository ), & st ) &&
1571+ } else if (!stat (git_path_cherry_pick_head (r ), & st ) &&
15701572 !get_oid ("CHERRY_PICK_HEAD" , & oid )) {
15711573 state -> cherry_pick_in_progress = 1 ;
15721574 oidcpy (& state -> cherry_pick_head_oid , & oid );
15731575 }
15741576 wt_status_check_bisect (NULL , state );
1575- if (!stat (git_path_revert_head (the_repository ), & st ) &&
1577+ if (!stat (git_path_revert_head (r ), & st ) &&
15761578 !get_oid ("REVERT_HEAD" , & oid )) {
15771579 state -> revert_in_progress = 1 ;
15781580 oidcpy (& state -> revert_head_oid , & oid );
15791581 }
15801582
15811583 if (get_detached_from )
1582- wt_status_get_detached_from (state );
1584+ wt_status_get_detached_from (r , state );
15831585}
15841586
15851587static void wt_longstatus_print_state (struct wt_status * s )
0 commit comments