<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sparse-index.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-02-26T15:22:51Z</updated>
<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>sparse-index: improve advice message instructions</title>
<updated>2025-10-20T16:20:50Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2025-10-20T14:24:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c32aa72466ec9da5762ef56f70ec10b42cab65da'/>
<id>urn:sha1:c32aa72466ec9da5762ef56f70ec10b42cab65da</id>
<content type='text'>
When an on-disk sparse index is expanded to a full one, it could be
due to some worktree state that requires looking at file entries
hidden within sparse tree entries. This can be avoided if the
worktree is cleaned up and some other issues related to the index
state are resolved.

Expand the advice message to include all of these cases, since 'git
sparse-checkout clean' is not currently capable of handling all
cases.

In the future, we may improve the behavior of 'git sparse-checkout
clean' to handle all of the cases.

Helped-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sparse-index: point users to new 'clean' action</title>
<updated>2025-09-15T19:10:57Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2025-09-12T10:30:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=66c11bd46a29f8f91297eaf6157be912bd0bf12a'/>
<id>urn:sha1:66c11bd46a29f8f91297eaf6157be912bd0bf12a</id>
<content type='text'>
In my experience, the most-common reason that the sparse index must
expand to a full one is because there is some leftover file in a tracked
directory that is now outside of the sparse-checkout. The new 'git
sparse-checkout clean' command will find and delete these directories,
so point users to it when they hit the sparse index expansion advice.

Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: mark code units that generate warnings with `-Wsign-compare`</title>
<updated>2024-12-06T11:20:02Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41f43b8243f42b9df2e98be8460646d4c0100ad3'/>
<id>urn:sha1:41f43b8243f42b9df2e98be8460646d4c0100ad3</id>
<content type='text'>
Mark code units that generate warnings with `-Wsign-compare`. This
allows for a structured approach to get rid of all such warnings over
time in a way that can be easily measured.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sparse-index: correctly free EWAH contents</title>
<updated>2024-11-05T06:37:56Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-05T06:17:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1f5ff83eab03773692fe6f7bab7f10ad82ab031b'/>
<id>urn:sha1:1f5ff83eab03773692fe6f7bab7f10ad82ab031b</id>
<content type='text'>
While we free the `fsmonitor_dirty` member of `struct index_state`, we
do not free the contents of that EWAH. Do so by using `ewah_free()`
instead of `FREE_AND_NULL()`.

This leak is exposed by t7519, but plugging it alone does not make the
test suite pass.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/sparse-checkout-expansion-advice'</title>
<updated>2024-10-02T14:46:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-10-02T14:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9293a931868f21029baf55935f2f092c3f06415f'/>
<id>urn:sha1:9293a931868f21029baf55935f2f092c3f06415f</id>
<content type='text'>
When "git sparse-checkout disable" turns a sparse checkout into a
regular checkout, the index is fully expanded.  This totally
expected behaviour however had an "oops, we are expanding the
index" advice message, which has been corrected.

* ds/sparse-checkout-expansion-advice:
  sparse-checkout: disable advice in 'disable'
</content>
</entry>
<entry>
<title>sparse-checkout: disable advice in 'disable'</title>
<updated>2024-09-23T20:19:01Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2024-09-23T19:31:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=537e516a39a760fddc4f3f5020c4118943f6c146'/>
<id>urn:sha1:537e516a39a760fddc4f3f5020c4118943f6c146</id>
<content type='text'>
When running 'git sparse-checkout disable' with the sparse index
enabled, Git is expected to expand the index into a full index. However,
it currently outputs the advice message saying that that is unexpected
and likely due to an issue with the working directory.

Disable this advice message when in this code path. Establish a pattern
for doing a similar removal in the future.

Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>environment: guard state depending on a repository</title>
<updated>2024-09-12T17:15:42Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-12T11:30:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=673af418d0f271faadb24486348430e547d32d2a'/>
<id>urn:sha1:673af418d0f271faadb24486348430e547d32d2a</id>
<content type='text'>
In "environment.h" we have quite a lot of functions and variables that
either explicitly or implicitly depend on `the_repository`.

The implicit set of stateful declarations includes for example variables
which get populated when parsing a repository's Git configuration. This
set of variables is broken by design, as their state often depends on
the last repository config that has been parsed. So they may or may not
represent the state of `the_repository`.

Fixing that is quite a big undertaking, and later patches in this series
will demonstrate a solution for a first small set of those variables. So
for now, let's guard these with `USE_THE_REPOSITORY_VARIABLE` so that
callers are aware of the implicit dependency.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/advice-sparse-index-expansion'</title>
<updated>2024-07-16T18:18:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-16T18:18:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d71940ddab3196e071dab466d456fd0297056d9'/>
<id>urn:sha1:5d71940ddab3196e071dab466d456fd0297056d9</id>
<content type='text'>
A new warning message is issued when a command has to expand a
sparse index to handle working tree cruft that are outside of the
sparse checkout.

* ds/advice-sparse-index-expansion:
  advice: warn when sparse index expands
</content>
</entry>
<entry>
<title>advice: warn when sparse index expands</title>
<updated>2024-07-08T19:23:59Z</updated>
<author>
<name>Derrick Stolee</name>
<email>stolee@gmail.com</email>
</author>
<published>2024-07-08T14:13:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9479a31d603ee94360f6c6819b69b7f96874f285'/>
<id>urn:sha1:9479a31d603ee94360f6c6819b69b7f96874f285</id>
<content type='text'>
Typically, forcing a sparse index to expand to a full index means that
Git could not determine the status of a file outside of the
sparse-checkout and needed to expand sparse trees into the full list of
sparse blobs. This operation can be very slow when the sparse-checkout
is much smaller than the full tree at HEAD.

When users are in this state, there is usually a modified or untracked
file outside of the sparse-checkout mentioned by the output of 'git
status'. There are a number of reasons why this is insufficient:

 1. Users may not have a full understanding of which files are inside or
    outside of their sparse-checkout. This is more common in monorepos
    that manage the sparse-checkout using custom tools that map build
    dependencies into sparse-checkout definitions.

 2. In some cases, an empty directory could exist outside the
    sparse-checkout and these empty directories are not reported by 'git
    status' and friends.

 3. If the user has '.gitignore' or 'exclude' files, then 'git status'
    will squelch the warnings and not demonstrate any problems.

In order to help users who are in this state, add a new advice message
to indicate that a sparse index is expanded to a full index. This
message should be written at most once per process, so add a static
global 'give_advice_on_expansion' to sparse-index.c. Further, there is a
case in 'git sparse-checkout set' that uses the sparse index as an
in-memory data structure (even when writing a full index) so we need to
disable the message in that kind of case.

The t1092-sparse-checkout-compatibility.sh test script compares the
behavior of several Git commands across full and sparse repositories,
including sparse repositories with and without a sparse index. We need
to disable the advice in the sparse-index repo to avoid differences in
stderr. By leaving the advice on in the sparse-checkout repo (without
the sparse index), we can test the behavior of disabling the advice in
convert_to_sparse(). (Indeed, these tests are how that necessity was
discovered.) Add a test that reenables the advice and demonstrates that
the message is output.

The advice message is defined outside of expand_index() to avoid super-
wide lines. It is also defined as a macro to avoid compile issues with
-Werror=format-security.

Signed-off-by: Derrick Stolee &lt;stolee@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
