Subject: Re: [PATCH V2 2/3] wt-status: pass struct repository and wt_status through function parameters

From: Shreyansh Paliwal <[email-masked]>
Date: Sun, 8 Feb 2026 10:14:14 +0530

> Shreyansh Paliwal <[email-masked]> writes:
> 
> > -int wt_status_check_rebase(const struct worktree *wt,
> > -			   struct wt_status_state *state)
> > +int wt_status_check_rebase(struct repository *r,
> > +	 			const struct worktree *wt,
> > +			    struct wt_status_state *state)
> 
> Funny indentation.

my bad, will fix it.

> 
> Besides, should we adding a yet another repository parameter to the
> function?  The worktree wt knows what repository it belongs to.
> 
> > -int wt_status_check_bisect(const struct worktree *wt,
> > +int wt_status_check_bisect(struct repository *r, 
> > +			   struct worktree *wt,
> >  			   struct wt_status_state *state)
> 
> Same comment about "r" vs "wt->repo" applies here.

Actually adding another repository parameter to both of these functions
is needed because of the calls like wt_status_check_rebase(NULL, state)
and wt_status_check_bisect(NULL, state) from wt_status_get_state().
In the case where wt is NULL, accessing wt->repo can lead to issues.