Subject: Re: [PATCH 1/2] wt-status: avoid passing NULL worktree

From: Shreyansh Paliwal <[email-masked]>
Date: Tue, 17 Feb 2026 15:48:38 +0530

> On 16/02/2026 16:18, Phillip Wood wrote:
> >
> > +struct worktree *get_worktree_from_repository(struct repository *repo)
> > +{
> > +	struct worktree *wt = xcalloc(1, sizeof(*wt));
> > +	char *gitdir = absolute_pathdup(repo->gitdir);
> > +	char *commondir = absolute_pathdup(repo->commondir);
> > +
> > +	wt->repo = repo;
> > +	if (repo->worktree)
> > +		wt->path = absolute_pathdup(repo->worktree);
> > +	wt->is_bare = !!repo->worktree;
> > +	if (fspathcmp(gitdir, commondir))
> > +		wt->id = xstrdup(find_last_dir_sep(commondir) + 1);
>
> Oops s/commondir/gitdir/ - I'll wait to see if there are any other
> comments before re-rolling (perhaps with a test that runs git status on
> a rebase in a linked worktree)
>
> Thanks
>
> Phillip

I wanted to just check for my understanding: the NULL usage of worktree in
get_worktree_git_dir() caller, repo_git_pathv() callers and inside function
add_reflogs_to_pending() is intentionally left unchanged for now,
and is meant for a follow-up once this gets gets finalized.
or it is out of scope wrt this cleanup?

Best,
Shreyansh