From: Junio C Hamano <gitster@pobox.com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, newren@gmail.com,
Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH] sparse-checkout: disable advice in 'disable'
Date: Mon, 23 Sep 2024 13:27:38 -0700 [thread overview]
Message-ID: <xmqqr09ayv2d.fsf@gitster.g> (raw)
In-Reply-To: <pull.1800.git.1727119882901.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Mon, 23 Sep 2024 19:31:22 +0000")
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Derrick Stolee <stolee@gmail.com>
>
> 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 the advice message for expanding a sparse index, as we
> + * are expecting to do that when disabling sparse-checkout.
> + */
> + give_advice_on_expansion = 0;
> repo_read_index(the_repository);
Sounds sensible.
> +/*
> + * If performing an operation where the index is supposed to expand to a
> + * full index, then disable the advice message by setting this global to
> + * zero.
> + */
> +extern int give_advice_on_expansion;
> +
> struct index_state;
> #define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
> int is_sparse_index_allowed(struct index_state *istate, int flags);
> diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
> index eb32da2a7f2..6e230b54876 100755
> --- a/t/t1092-sparse-checkout-compatibility.sh
> +++ b/t/t1092-sparse-checkout-compatibility.sh
> @@ -2355,7 +2355,10 @@ test_expect_success 'advice.sparseIndexExpanded' '
> mkdir -p sparse-index/deep/deeper2/deepest &&
> touch sparse-index/deep/deeper2/deepest/bogus &&
> git -C sparse-index status 2>err &&
> - grep "The sparse index is expanding to a full index" err
> + grep "The sparse index is expanding to a full index" err &&
> +
> + git -C sparse-index sparse-checkout disable 2>err &&
> + test_line_count = 0 err
I am not a huge fun of insisting that other code in the code path in
which I got rid of an unwanted error message must stay silent. As
we are expanding to full, we are presumably rehydrating all the
directories that was sparsified, so it might be reasonable if we
want to see a progress output during this operation, for example [*].
Would it make more sense to look for the lack of specific advice
message instead?
[Footnote]
* A mere example to illustrate the principle. "We disable progress
during test", or "this is so small that progress won't trigger"
may both be a good reaction to the example, but the general point
still stands.
next prev parent reply other threads:[~2024-09-23 20:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 19:31 [PATCH] sparse-checkout: disable advice in 'disable' Derrick Stolee via GitGitGadget
2024-09-23 20:27 ` Junio C Hamano [this message]
2024-09-25 13:48 ` Derrick Stolee
2024-09-25 16:44 ` Junio C Hamano
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=xmqqr09ayv2d.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=stolee@gmail.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).