git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Derrick Stolee <derrickstolee@github.com>
To: Victoria Dye <vdye@github.com>,
	Shuqi Liang <cheskaqiqi@gmail.com>,
	git@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] check-attr: integrate with sparse-index
Date: Mon, 27 Feb 2023 12:57:32 -0500	[thread overview]
Message-ID: <cd7b9a2f-4f52-9da8-19c3-2c5cda7b8160@github.com> (raw)
In-Reply-To: <315e70e0-ac1f-2f19-f1cc-6b8b24ffb1fc@github.com>

On 2/27/2023 12:18 PM, Victoria Dye wrote:
> Shuqi Liang wrote:

>> +	prepare_repo_settings(the_repository);
>> +	the_repository->settings.command_requires_full_index = 0;
> 
> The test below doesn't do anything special related to the sparse index, so
> this change is unnecessary (and, as far as I can tell, will break in some
> usage of 'git check-attr'). If you're only looking for feedback on testing,
> it'd better to leave this out.

This change is part of the performance improvements given by sparse index,
but the correctness test you've added only ensures that the end result is
correct, not fast.

It's possible that even with this change we hit an ensure_full_index() call
somewhere in the call stack. To test that the sparse-index stays sparse
throughout the process lifetime (when possible) create a test that uses the
ensure_not_expanded helper. There are several examples in t1092 to use as
a starting point.

Victoria is right that it is helpful to first establish test coverage of
the builtin for correctness reasons before making this change. It helps to
add tests for cases that would require expanding the sparse index, such as
checking the attributes for paths outside of the sparse-checkout cone.

Once the correctness tests are in place, you can then make this change to
the builtin and add the tests that check ensure_not_expanded, since the
change at that point is _only_ that we are allowing the builtin to
operate upon the sparse index without expanding it immediately after read.

A good example of this "final step" is [1], which updates the builtin for
'git diff' as well as adding _only_ the ensure_not_expanded tests.

[1] https://lore.kernel.org/git/897611682af64ba6bd0d2dfcfeae56cfe953c45e.1638806161.git.gitgitgadget@gmail.com/
    [PATCH v6 6/7] diff: enable and test the sparse index

You can look at the surrounding patches for other ideas, but it should be
noted that both 'git diff' and 'git blame' in that series had previous
correctness tests in t1092 that only needed _edits_, instead of being
created from scratch.

Thanks,
-Stolee

  reply	other threads:[~2023-02-27 17:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  5:05 [RFC PATCH 0/1] check-attr: integrate with sparse-index Shuqi Liang
2023-02-27  5:05 ` [RFC PATCH 1/1] " Shuqi Liang
2023-02-27 17:18   ` Victoria Dye
2023-02-27 17:57     ` Derrick Stolee [this message]
2023-02-27 18:51       ` Junio C Hamano
2023-02-28 18:10       ` Shuqi Liang
2023-02-27 17:18 ` [RFC PATCH 0/1] " Victoria Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd7b9a2f-4f52-9da8-19c3-2c5cda7b8160@github.com \
    --to=derrickstolee@github.com \
    --cc=cheskaqiqi@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).