<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/wt-status.c, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-03-16T17:48:14Z</updated>
<entry>
<title>Merge branch 'sp/wt-status-wo-the-repository'</title>
<updated>2026-03-16T17:48:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-16T17:48:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8ac2bf3f092454e00a325dfd280f56f0a8f0f15'/>
<id>urn:sha1:b8ac2bf3f092454e00a325dfd280f56f0a8f0f15</id>
<content type='text'>
Reduce dependence on the global the_hash_algo and the_repository
variables of wt-status code path.

* sp/wt-status-wo-the-repository:
  wt-status: use hash_algo from local repository instead of global the_hash_algo
  wt-status: replace uses of the_repository with local repository instances
  wt-status: pass struct repository through function parameters
</content>
</entry>
<entry>
<title>Merge branch 'ob/core-attributesfile-in-repository'</title>
<updated>2026-03-05T18:04:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-05T18:04:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db227bce2224b55b11954a5f292a0b035b7d9279'/>
<id>urn:sha1:db227bce2224b55b11954a5f292a0b035b7d9279</id>
<content type='text'>
The core.attributesfile is intended to be set per repository, but
were kept track of by a single global variable in-core, which has
been corrected by moving it to per-repository data structure.

* ob/core-attributesfile-in-repository:
  environment: move "branch.autoSetupMerge" into `struct repo_config_values`
  environment: stop using core.sparseCheckout globally
  environment: stop storing `core.attributesFile` globally
</content>
</entry>
<entry>
<title>Merge branch 'pw/no-more-NULL-means-current-worktree'</title>
<updated>2026-03-04T18:53:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-04T18:53:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b7d67104e315437c46e62986e163c97c5a51dd3'/>
<id>urn:sha1:7b7d67104e315437c46e62986e163c97c5a51dd3</id>
<content type='text'>
API clean-up for the worktree subsystem.

* pw/no-more-NULL-means-current-worktree:
  path: remove repository argument from worktree_git_path()
  wt-status: avoid passing NULL worktree
</content>
</entry>
<entry>
<title>environment: stop using core.sparseCheckout globally</title>
<updated>2026-02-26T15:22:51Z</updated>
<author>
<name>Olamide Caleb Bello</name>
<email>belkid98@gmail.com</email>
</author>
<published>2026-02-16T16:38:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4021751558126d39b642503e7ef4768131df45e7'/>
<id>urn:sha1:4021751558126d39b642503e7ef4768131df45e7</id>
<content type='text'>
The config value `core.sparseCheckout` is parsed in
`git_default_core_config()` and stored globally in
`core_apply_sparse_checkout`. This could cause it to be overwritten
by another repository when different Git repositories run in the same
process.

Move the parsed value into `struct repo_config_values` in the_repository
to retain current behaviours and move towards libifying Git.

Suggested-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Mentored-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Mentored-by: Usman Akinyemi &lt;usmanakinyemi202@gmail.com&gt;
Signed-off-by: Olamide Caleb Bello &lt;belkid98@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>path: remove repository argument from worktree_git_path()</title>
<updated>2026-02-19T19:03:24Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-02-19T14:26:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a49cb0f093809e3e66566f161aa930f37346775d'/>
<id>urn:sha1:a49cb0f093809e3e66566f161aa930f37346775d</id>
<content type='text'>
worktree_git_path() takes a struct repository and a struct worktree
which also contains a struct repository. The repository argument
was added by a973f60dc7c (path: stop relying on `the_repository` in
`worktree_git_path()`, 2024-08-13) and exists because the worktree
argument is optional. Having two ways of passing a repository is
a potential foot-gun as if the the worktree argument is present the
repository argument must match the worktree's repository member. Since
the last commit there are no callers that pass a NULL worktree so lets
remove the repository argument. This removes the potential confusion
and lets us delete a number of uses of "the_repository".

worktree_git_path() has the following callers:

 - builtin/worktree.c:validate_no_submodules() which is called from
   check_clean_worktree() and move_worktree(), both of which supply
   a non-NULL worktree.

 - builtin/fsck.c:cmd_fsck() which loops over all worktrees.

 - revision.c:add_index_objects_to_pending() which loops over all
   worktrees.

 - worktree.c:worktree_lock_reason() which dereferences wt before
   calling worktree_git_path().

 - wt-status.c:wt_status_check_bisect() and wt_status_check_rebase()
   which are always called with a non-NULL worktree after the last
   commit.

 - wt-status.c:git_branch() which is only called by
   wt_status_check_bisect() and wt_status_check_rebase().

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wt-status: avoid passing NULL worktree</title>
<updated>2026-02-19T19:03:23Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-02-19T14:26:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cb18484385eb66f6220d2418d62ad790358899d1'/>
<id>urn:sha1:cb18484385eb66f6220d2418d62ad790358899d1</id>
<content type='text'>
In preparation for removing the repository argument from
worktree_git_path() add a function to construct a "struct worktree"
from a "struct repository" using its "gitdir" and "worktree"
members. This function is then used to avoid passing a NULL worktree to
wt_status_check_bisect() and wt_status_check_rebase(). In general the
"struct worktree" returned may not correspond to the "current" worktree
defined by is_current_worktree() as that function uses "the_repository"
rather than "wt-&gt;repo" when deciding which worktree is "current". In
practice the "struct repository" we pass corresponds to "the_repository"
as we only ever operate on a single repository at the moment.

wt_status_check_bisect() and wt_status_check_rebase() have the following
callers:

 - branch.c:prepare_checked_out_branches() which loops over all
   worktrees.

 - worktree.c:is_worktree_being_rebased() which is called from
   builtin/branch.c:reject_rebase_or_bisect_branch() that loops over all
   worktrees and worktree.c:is_shared_symref() which dereferences wt
   earlier in the function.

 - wt-status:wt_status_get_state() which is updated to avoid passing a
   NULL worktree by this patch.

This updates the only callers that pass a NULL worktree to
worktree_git_path(). A new test is added to check that "git status"
detects a rebase in a linked worktree.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wt-status: use hash_algo from local repository instead of global the_hash_algo</title>
<updated>2026-02-19T16:59:24Z</updated>
<author>
<name>Shreyansh Paliwal</name>
<email>shreyanshpaliwalcmsmn@gmail.com</email>
</author>
<published>2026-02-18T17:53:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7cd24de0b3b679c16ae3ee8215af06aeea1e6a3'/>
<id>urn:sha1:a7cd24de0b3b679c16ae3ee8215af06aeea1e6a3</id>
<content type='text'>
wt-status.c still uses the global the_hash_algo even though a repository
instance is already available via struct wt_status.

Replace uses of the_hash_algo with the hash algorithm stored in the
associated repository (s-&gt;repo-&gt;hash_algo or r-&gt;hash_algo).

This removes another dependency on global state and keeps wt-status
consistent with local repository usage.

Signed-off-by: Shreyansh Paliwal &lt;shreyanshpaliwalcmsmn@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wt-status: replace uses of the_repository with local repository instances</title>
<updated>2026-02-19T16:59:24Z</updated>
<author>
<name>Shreyansh Paliwal</name>
<email>shreyanshpaliwalcmsmn@gmail.com</email>
</author>
<published>2026-02-18T17:53:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d0d2ba217f3ceefb0315b556f012edb598b9724'/>
<id>urn:sha1:9d0d2ba217f3ceefb0315b556f012edb598b9724</id>
<content type='text'>
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-&gt;repo or r).

The replacements of all the_repository with s-&gt;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-&gt;repo from the repository provided by the caller. As a result, s-&gt;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 &lt;shreyanshpaliwalcmsmn@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wt-status: pass struct repository through function parameters</title>
<updated>2026-02-19T16:59:23Z</updated>
<author>
<name>Shreyansh Paliwal</name>
<email>shreyanshpaliwalcmsmn@gmail.com</email>
</author>
<published>2026-02-18T17:53:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4631e22f925fa2af8d8548af97ee2215be101409'/>
<id>urn:sha1:4631e22f925fa2af8d8548af97ee2215be101409</id>
<content type='text'>
Some functions in wt-status.c (count_stash_entries(),
read_line_from_git_path(), abbrev_oid_in_line(), and
read_rebase_todolist()) rely on the_repository as they do not have access
to a local repository instance.

Add a struct repository *r parameter to these functions and pass the local
repository instance through the callers, which already have access to it
either directly by struct repository *r or indirectly by struct wt_state
*s (s-&gt;repo).

Replace uses of the_repository in these functions with the passed parameter.

Signed-off-by: Shreyansh Paliwal &lt;shreyanshpaliwalcmsmn@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wt-status: provide function to expose status for trees</title>
<updated>2026-01-13T13:41:16Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-01-13T09:54:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=475ade1cd6e8ff07495b4b5871a69f7b385259f7'/>
<id>urn:sha1:475ade1cd6e8ff07495b4b5871a69f7b385259f7</id>
<content type='text'>
The "wt-status" subsystem is responsible for printing status information
around the current state of the working tree. This most importantly
includes information around whether the working tree or the index have
any changes.

We're about to introduce a new command where the changes in neither of
them are actually relevant to us. Instead, what we want is to format the
changes between two different trees. While it is a little bit of a
stretch to add this as functionality to _working tree_ status, it
doesn't make any sense to open-code this functionality, either.

Implement a new function `wt_status_collect_changes_trees()` that diffs
two trees and formats the status accordingly. This function is not yet
used, but will be in a subsequent commit.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
