From: Elijah Newren <newren@gmail.com>
To: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>,
"Junio C Hamano" <gitster@pobox.com>,
"Matheus Tavares Bernardino" <matheus.bernardino@usp.br>,
"Derrick Stolee" <stolee@gmail.com>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Eric Sunshine" <sunshine@sunshineco.com>,
"René Scharfe" <l.s.r@web.de>,
"Derrick Stolee" <derrickstolee@github.com>,
"Derrick Stolee" <dstolee@microsoft.com>
Subject: Re: [PATCH v4 10/10] sparse-checkout: add config to disable deleting dirs
Date: Fri, 27 Aug 2021 13:58:17 -0700 [thread overview]
Message-ID: <CABPp-BGeJJBF0ZmS7ZHcqFmXwXmgVH1Uox_6gNHzcacG2vRjVw@mail.gmail.com> (raw)
In-Reply-To: <8d55a6ba2fdf64cee4eb51f3cb6f9808bd0b7505.1629841904.git.gitgitgadget@gmail.com>
On Tue, Aug 24, 2021 at 2:51 PM Derrick Stolee via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Derrick Stolee <dstolee@microsoft.com>
>
> The clean_tracked_sparse_directories() method deletes the tracked
> directories that go out of scope when the sparse-checkout cone changes,
> at least in cone mode. This is new behavior, but is recommended based on
> our understanding of how users are interacting with the feature in most
> cases.
>
> It is possible that some users will object to the new behavior, so
> create a new configuration option 'index.deleteSparseDirectories' that
> can be set to 'false' to make clean_tracked_sparse_directories() do
> nothing. This will keep all untracked files in the working tree and
> cause performance problems with the sparse index, but those trade-offs
> are for the user to decide.
I'm not sold that we need anything here, and it sounds like this is
all being added based on a theoretical concern. I might not object
too much normally to trying to address theoretical conerns with new
features, but:
* I'm a little concerned that we're adding a configuration option
(which live forever and are harder to work with
backward-compatibility-wise) rather than a command line flag.
* It's not clear to me that the option name is what we want. For
example, git checkout has a --[no-]overwrite-ignored for overwriting
ignored files (or not) when switching to a different branch. git
merge has the same flags (though only the fast-forwarding backend
heeds it currently). This behavior is quite similar to that flag, and
has the same default of treating ignored files as expendable. Should
the naming be more similar?
* It's not clear to me that the option has the right level of
implementation granularity. If someone wants ignored files to be
treated as important, should they need to set a
merge.no_overwrite_ignored AND a checkout.no_overwrite_ignored AND a
index.deleteSparseDirectories AND other names, or have one high-level
option that sets all of these behaviors?
>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
> Documentation/config/index.txt | 6 ++++++
> builtin/sparse-checkout.c | 9 ++++++++-
> t/t1091-sparse-checkout-builtin.sh | 4 ++++
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config/index.txt b/Documentation/config/index.txt
> index 75f3a2d1054..c65da20a931 100644
> --- a/Documentation/config/index.txt
> +++ b/Documentation/config/index.txt
> @@ -1,3 +1,9 @@
> +index.deleteSparseDirectories::
> + When enabled, the cone mode sparse-checkout feature will delete
> + directories that are outside of the sparse-checkout cone, unless
> + such a directory contains an untracked, non-ignored file. Defaults
> + to true.
> +
> index.recordEndOfIndexEntries::
> Specifies whether the index file should include an "End Of Index
> Entry" section. This reduces index load time on multiprocessor
> diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
> index d0f5c4702be..33ec729d9de 100644
> --- a/builtin/sparse-checkout.c
> +++ b/builtin/sparse-checkout.c
> @@ -102,7 +102,7 @@ static int sparse_checkout_list(int argc, const char **argv)
>
> static void clean_tracked_sparse_directories(struct repository *r)
> {
> - int i, was_full = 0;
> + int i, value, was_full = 0;
> struct strbuf path = STRBUF_INIT;
> size_t pathlen;
> struct string_list_item *item;
> @@ -118,6 +118,13 @@ static void clean_tracked_sparse_directories(struct repository *r)
> !r->index->sparse_checkout_patterns->use_cone_patterns)
> return;
>
> + /*
> + * Users can disable this behavior.
> + */
> + if (!repo_config_get_bool(r, "index.deletesparsedirectories", &value) &&
> + !value)
> + return;
> +
> /*
> * Use the sparse index as a data structure to assist finding
> * directories that are safe to delete. This conversion to a
> diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
> index 71236981e64..e0f31186d89 100755
> --- a/t/t1091-sparse-checkout-builtin.sh
> +++ b/t/t1091-sparse-checkout-builtin.sh
> @@ -666,6 +666,10 @@ test_expect_success 'cone mode clears ignored subdirectories' '
> git -C repo status --porcelain=v2 >out &&
> test_must_be_empty out &&
>
> + git -C repo -c index.deleteSparseDirectories=false sparse-checkout reapply &&
> + test_path_is_dir repo/folder1 &&
> + test_path_is_dir repo/deep/deeper2 &&
> +
> git -C repo sparse-checkout reapply &&
> test_path_is_missing repo/folder1 &&
> test_path_is_missing repo/deep/deeper2 &&
> --
> gitgitgadget
next prev parent reply other threads:[~2021-08-27 20:59 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 17:27 [PATCH 0/2] Sparse index: delete ignored files outside sparse cone Derrick Stolee via GitGitGadget
2021-07-29 17:27 ` [PATCH 1/2] t7519: rewrite sparse index test Derrick Stolee via GitGitGadget
2021-07-29 17:27 ` [PATCH 2/2] sparse-checkout: clear tracked sparse dirs Derrick Stolee via GitGitGadget
2021-07-30 13:52 ` Elijah Newren
2021-08-02 14:34 ` Derrick Stolee
2021-08-02 16:17 ` Elijah Newren
2021-08-05 1:55 ` Derrick Stolee
2021-08-05 3:54 ` Elijah Newren
2021-07-30 13:11 ` [PATCH 0/2] Sparse index: delete ignored files outside sparse cone Elijah Newren
2021-08-10 19:50 ` [PATCH v2 0/8] " Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 1/8] t7519: rewrite sparse index test Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 2/8] sparse-index: silently return when not using cone-mode patterns Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 3/8] sparse-index: silently return when cache tree fails Derrick Stolee via GitGitGadget
2021-08-19 18:24 ` Elijah Newren
2021-08-20 15:04 ` Derrick Stolee
2021-08-10 19:50 ` [PATCH v2 4/8] unpack-trees: fix nested sparse-dir search Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 5/8] sparse-checkout: create helper methods Derrick Stolee via GitGitGadget
2021-08-12 17:29 ` Derrick Stolee
2021-08-10 19:50 ` [PATCH v2 6/8] attr: be careful about sparse directories Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 7/8] sparse-index: add SPARSE_INDEX_IGNORE_CONFIG flag Derrick Stolee via GitGitGadget
2021-08-10 19:50 ` [PATCH v2 8/8] sparse-checkout: clear tracked sparse dirs Derrick Stolee via GitGitGadget
2021-08-17 13:23 ` [PATCH v3 0/8] Sparse index: delete ignored files outside sparse cone Derrick Stolee via GitGitGadget
2021-08-17 13:23 ` [PATCH v3 1/8] t7519: rewrite sparse index test Derrick Stolee via GitGitGadget
2021-08-19 7:45 ` Johannes Schindelin
2021-08-20 15:09 ` Derrick Stolee
2021-08-20 16:40 ` Eric Sunshine
2021-08-17 13:23 ` [PATCH v3 2/8] sparse-index: silently return when not using cone-mode patterns Derrick Stolee via GitGitGadget
2021-08-17 13:23 ` [PATCH v3 3/8] sparse-index: silently return when cache tree fails Derrick Stolee via GitGitGadget
2021-08-17 13:23 ` [PATCH v3 4/8] unpack-trees: fix nested sparse-dir search Derrick Stolee via GitGitGadget
2021-08-19 8:01 ` Johannes Schindelin
2021-08-20 15:18 ` Derrick Stolee
2021-08-20 19:35 ` René Scharfe
2021-08-20 20:22 ` René Scharfe
2021-08-19 18:29 ` Elijah Newren
2021-08-17 13:23 ` [PATCH v3 5/8] sparse-checkout: create helper methods Derrick Stolee via GitGitGadget
2021-08-19 8:07 ` Johannes Schindelin
2021-08-20 15:30 ` Derrick Stolee
2021-08-17 13:23 ` [PATCH v3 6/8] attr: be careful about sparse directories Derrick Stolee via GitGitGadget
2021-08-19 8:11 ` Johannes Schindelin
2021-08-20 15:36 ` Derrick Stolee
2021-08-19 20:53 ` Elijah Newren
2021-08-20 15:39 ` Derrick Stolee
2021-08-20 16:05 ` Elijah Newren
2021-08-17 13:23 ` [PATCH v3 7/8] sparse-index: add SPARSE_INDEX_IGNORE_CONFIG flag Derrick Stolee via GitGitGadget
2021-08-18 18:59 ` Derrick Stolee
2021-08-17 13:23 ` [PATCH v3 8/8] sparse-checkout: clear tracked sparse dirs Derrick Stolee via GitGitGadget
2021-08-19 8:48 ` Johannes Schindelin
2021-08-20 15:49 ` Derrick Stolee
2021-08-20 16:15 ` Elijah Newren
2021-08-20 15:56 ` Elijah Newren
2021-08-23 20:00 ` Johannes Schindelin
2021-08-17 14:09 ` [PATCH v3 0/8] Sparse index: delete ignored files outside sparse cone Elijah Newren
2021-08-24 21:51 ` [PATCH v4 00/10] " Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 01/10] t7519: rewrite sparse index test Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 02/10] sparse-index: silently return when not using cone-mode patterns Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 03/10] sparse-index: silently return when cache tree fails Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 04/10] sparse-index: use WRITE_TREE_MISSING_OK Derrick Stolee via GitGitGadget
2021-08-27 21:33 ` Elijah Newren
2021-08-30 13:19 ` Derrick Stolee
2021-08-30 20:08 ` Elijah Newren
2021-08-24 21:51 ` [PATCH v4 05/10] unpack-trees: fix nested sparse-dir search Derrick Stolee via GitGitGadget
2021-08-24 22:21 ` René Scharfe
2021-08-25 1:09 ` Derrick Stolee
2021-08-24 21:51 ` [PATCH v4 06/10] sparse-checkout: create helper methods Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 07/10] attr: be careful about sparse directories Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 08/10] sparse-index: add SPARSE_INDEX_MEMORY_ONLY flag Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 09/10] sparse-checkout: clear tracked sparse dirs Derrick Stolee via GitGitGadget
2021-08-24 21:51 ` [PATCH v4 10/10] sparse-checkout: add config to disable deleting dirs Derrick Stolee via GitGitGadget
2021-08-27 20:58 ` Elijah Newren [this message]
2021-08-30 13:30 ` Derrick Stolee
2021-08-30 20:11 ` Elijah Newren
2021-08-27 21:56 ` [PATCH v4 00/10] Sparse index: delete ignored files outside sparse cone Elijah Newren
2021-08-27 22:01 ` Elijah Newren
2021-08-30 13:34 ` Derrick Stolee
2021-08-30 20:14 ` Elijah Newren
2021-08-30 13:54 ` Derrick Stolee
2021-08-30 20:23 ` Elijah Newren
2021-09-08 1:42 ` [PATCH v5 0/9] " Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 1/9] t7519: rewrite sparse index test Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 2/9] sparse-index: silently return when not using cone-mode patterns Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 3/9] unpack-trees: fix nested sparse-dir search Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 4/9] sparse-index: silently return when cache tree fails Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 5/9] sparse-index: use WRITE_TREE_MISSING_OK Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 6/9] sparse-checkout: create helper methods Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 7/9] attr: be careful about sparse directories Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 8/9] sparse-index: add SPARSE_INDEX_MEMORY_ONLY flag Derrick Stolee via GitGitGadget
2021-09-08 1:42 ` [PATCH v5 9/9] sparse-checkout: clear tracked sparse dirs Derrick Stolee via GitGitGadget
2021-09-08 5:21 ` [PATCH v5 0/9] Sparse index: delete ignored files outside sparse cone Junio C Hamano
2021-09-08 6:56 ` Junio C Hamano
2021-09-08 11:39 ` Derrick Stolee
2021-09-08 16:11 ` Junio C Hamano
2021-09-08 5:30 ` Elijah Newren
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABPp-BGeJJBF0ZmS7ZHcqFmXwXmgVH1Uox_6gNHzcacG2vRjVw@mail.gmail.com \
--to=newren@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=derrickstolee@github.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=matheus.bernardino@usp.br \
--cc=stolee@gmail.com \
--cc=sunshine@sunshineco.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).