]> Kevux Git Server - rit/commit
wt-status: replace uses of the_repository with local repository instances
authorShreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Wed, 18 Feb 2026 17:53:41 +0000 (23:23 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Feb 2026 16:59:24 +0000 (08:59 -0800)
commit9d0d2ba217f3ceefb0315b556f012edb598b9724
tree62b788dcf53e6f1f4de8d02906be59f17bf59f95
parent4631e22f925fa2af8d8548af97ee2215be101409
wt-status: replace uses of the_repository with local repository instances

wt-status.c uses the global the_repository in several places even when a
repository instance is already available via struct wt_status *s or struct
repository *r.

Replace these uses of the_repository with the repository available in the
local context (i.e. s->repo or r).

The replacements of all the_repository with s->repo are mostly to cases
where a repository instance is already available via struct wt_status *s
and struct repository *r, all functions operating on struct wt_status *s
are only used after s is initialized by wt_status_prepare(), which sets
s->repo from the repository provided by the caller. As a result, s->repo is
guaranteed to be available and consistent whenever these functions are
invoked.

This reduces reliance on global state and keeps wt-status consistent,
though many functions operating on struct wt_status *s are called via
commit.c and it still relies on the_repository, but within wt-status.c the
local repository pointer refers to the same underlying repository object.

Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
wt-status.c