git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Victoria Dye <vdye@github.com>,
	Lessley Dennington <lessleydennington@gmail.com>,
	Derrick Stolee <derrickstolee@github.com>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2 8/9] git-sparse-checkout.txt: mark non-cone mode as deprecated
Date: Mon, 14 Mar 2022 21:13:57 +0000	[thread overview]
Message-ID: <xmqqa6dsp78q.fsf@gitster.g> (raw)
In-Reply-To: <2d2b81986a55f0692d5536dec88079c58853f205.1647054681.git.gitgitgadget@gmail.com> (Elijah Newren via GitGitGadget's message of "Sat, 12 Mar 2022 03:11:20 +0000")

"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> +the default mode, but we do not recommend using it.  It does not work
> +with the `--sparse-index` option, and will likely be incompatible with
> +other new features as they are added.

If we explicitly say we have no intention to remove, while saying
that "non-cone" mode is a second class citizen, the users would be
confused. Does this mixed attitude only apply to non-cone mode, or
is it true for any other fringe features that we do not care about
in Git?

This does not build confidence with the Git software suite.  If we
are removing, then this attitude is OK, but if we are keeping it,
then we should promise that we never add features only to "cone".

> +INTERNALS -- NON-CONE PROBLEMS
> +------------------------------
> +
> +The `$GIT_DIR/info/sparse-checkout` file populated by the `set` and
> +`add` subcommands is defined to be a bunch of patterns (one per line)
> +using the same syntax as `.gitignore` files.  In cone mode, these
> +patterns are restricted to matching directories (and users only ever
> +need supply or see directory names), while in non-cone mode any
> +gitignore-style pattern is permitted.  Using the full gitignore-style
> +patterns in non-cone mode has a number of shortcomings:
> +
> +  * Fundamentally, it makes various worktree-updating processes (pull,
> +    merge, rebase, switch, reset, checkout, etc.) require O(N*M) pattern
> +    matches, where N is the number of patterns and M is the number of
> +    paths in the index.  This scales poorly.
> +
> +  * Avoiding the scaling issue has to be done via limiting the number
> +    of patterns via specifying leading directory name or glob.

These are valid.

> +  * Passing globs on the command line is error-prone as users may
> +    forget to quote the glob, causing the shell to expand it into all
> +    matching files and pass them all individually along to
> +    sparse-checkout set/add.  This both exacerbates the scaling
> +    problem, and hardcodes the list of selected files to those which
> +    were present at the time the initial set/add subcommand was run
> +    (and thus ignoring other files matching the same glob which come
> +    into the working tree after switching branches or pulling down
> +    updates).

That's end-user mistakes that is common to other things like
pathspecs, i.e. "git grep -- \*.c" vs "git grep -- *.c".  It hardly
deserves to spend more than 5 lines shouting.

> +  * It uses "ignore"/"exclude" syntax for selecting what to "include",
> +    which periodically causes confusion.

Well, .gitignore uses the syntax to select the paths to include or
exclude from a set, and then the set specifies what is left out of
the index.  I am not sure if that is the source of confusion.

> +  * It introduces inconsistencies in the Git command line, since other
> +    commands use pathspecs, but sparse-checkout (in non-cone mode) uses
> +    gitignore patterns.

But "cone" mode does not take pathspec, does it?  ":(icase)/A/B/C"
for example?  I do not see this as a credible argument against it.

> +  * It has edge cases where the "right" behavior is unclear.  Two examples:
> +
> +    First, two users are in a subdirectory, and the first runs
> +       git sparse-checkout set '/toplevel-dir/*.c'
> +    while the second runs
> +       git sparse-checkout set relative-dir

Are we aware which mode of sparse-checkout they are in?  Do we give
a mechanism for users to ask "we have 'non-cone' sparse checkout in
the sparse-checkout file.  we want to use the more efficient and
recommended 'cone' mode.  Please convert it", or even if there is
not an automated conversion mechansim, can the user manually do so
(which I suspect is not fundamentally possible---the cone mode is
inherently less expressive)?

If not, then we should expect these two users to _know_ (or at least
check before they run "set" subcommand) which mode is in use.

So, with that expectation,

> +    Should those arguments be transliterated into
> +       current/subdirectory/toplevel-dir/*.c
> +    and
> +       current/subdirectory/relative-dir

If we are using non-cone mode, then both would be recorded as-is.

If we are using cone mode, we may reject the one that ends with "*.c"
based on the two traits it has, i.e. (1) there is no such directory
in the working tree nor the index nor the HEAD, and (2) it has an
unusual character (i.e. glob) '*' to be in a real path.

  reply	other threads:[~2022-03-14 21:14 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  7:39 [PATCH 0/9] sparse-checkout: make cone mode the default Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 1/9] tests: stop assuming --no-cone is the default mode for sparse-checkout Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 2/9] sparse-checkout: make --cone the default Elijah Newren via GitGitGadget
2022-03-08 14:26   ` Derrick Stolee
2022-03-12  2:01     ` Elijah Newren
2022-03-08  7:39 ` [PATCH 3/9] git-sparse-checkout.txt: wording updates for the cone mode default Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 4/9] git-sparse-checkout.txt: update docs for deprecation of 'init' Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 5/9] git-sparse-checkout.txt: shuffle some sections and mark as internal Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 6/9] git-sparse-checkout.txt: add a new EXAMPLES section Elijah Newren via GitGitGadget
2022-03-08 14:30   ` Derrick Stolee
2022-03-12  1:58     ` Elijah Newren
2022-03-08  7:39 ` [PATCH 7/9] git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a bit Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 8/9] git-sparse-checkout.txt: mark non-cone mode as deprecated Elijah Newren via GitGitGadget
2022-03-08  7:39 ` [PATCH 9/9] Documentation: some sparsity wording clarifications Elijah Newren via GitGitGadget
2022-03-08 14:34 ` [PATCH 0/9] sparse-checkout: make cone mode the default Derrick Stolee
2022-03-12  3:11 ` [PATCH v2 " Elijah Newren via GitGitGadget
2022-03-12  3:11   ` [PATCH v2 1/9] tests: stop assuming --no-cone is the default mode for sparse-checkout Elijah Newren via GitGitGadget
2022-03-14 20:18     ` Junio C Hamano
2022-03-15 17:15       ` Derrick Stolee
2022-03-12  3:11   ` [PATCH v2 2/9] sparse-checkout: make --cone the default Elijah Newren via GitGitGadget
2022-03-14 20:34     ` Junio C Hamano
2022-04-22  2:29       ` Elijah Newren
2022-03-12  3:11   ` [PATCH v2 3/9] git-sparse-checkout.txt: wording updates for the cone mode default Elijah Newren via GitGitGadget
2022-03-14 20:39     ` Junio C Hamano
2022-03-12  3:11   ` [PATCH v2 4/9] git-sparse-checkout.txt: update docs for deprecation of 'init' Elijah Newren via GitGitGadget
2022-03-14 20:53     ` Junio C Hamano
2022-04-22  2:29       ` Elijah Newren
2022-04-22  6:09         ` Junio C Hamano
2022-03-12  3:11   ` [PATCH v2 5/9] git-sparse-checkout.txt: shuffle some sections and mark as internal Elijah Newren via GitGitGadget
2022-03-14 20:55     ` Junio C Hamano
2022-04-22  2:30       ` Elijah Newren
2022-03-12  3:11   ` [PATCH v2 6/9] git-sparse-checkout.txt: add a new EXAMPLES section Elijah Newren via GitGitGadget
2022-03-12  3:11   ` [PATCH v2 7/9] git-sparse-checkout.txt: flesh out non-cone mode pattern discussion a bit Elijah Newren via GitGitGadget
2022-03-14 20:57     ` Junio C Hamano
2022-04-22  2:30       ` Elijah Newren
2022-03-12  3:11   ` [PATCH v2 8/9] git-sparse-checkout.txt: mark non-cone mode as deprecated Elijah Newren via GitGitGadget
2022-03-14 21:13     ` Junio C Hamano [this message]
2022-04-22  2:31       ` Elijah Newren
2022-03-12  3:11   ` [PATCH v2 9/9] Documentation: some sparsity wording clarifications Elijah Newren via GitGitGadget
2022-03-14 15:25   ` [PATCH v2 0/9] sparse-checkout: make cone mode the default Derrick Stolee
2022-03-14 19:04   ` Victoria Dye
2022-03-14 20:12   ` Junio C Hamano
2022-03-14 23:19     ` Junio C Hamano
2022-04-22  2:32   ` [PATCH v3 " Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 1/9] tests: stop assuming --no-cone is the default mode for sparse-checkout Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 2/9] sparse-checkout: make --cone the default Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 3/9] git-sparse-checkout.txt: wording updates for the cone mode default Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 4/9] git-sparse-checkout.txt: update docs for deprecation of 'init' Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 5/9] git-sparse-checkout.txt: shuffle some sections and mark as internal Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 6/9] git-sparse-checkout.txt: add a new EXAMPLES section Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 7/9] git-sparse-checkout.txt: flesh out pattern set sections a bit Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 8/9] git-sparse-checkout.txt: mark non-cone mode as deprecated Elijah Newren via GitGitGadget
2022-04-22  2:32     ` [PATCH v3 9/9] Documentation: some sparsity wording clarifications Elijah Newren via GitGitGadget
2022-04-25 14:38     ` [PATCH v3 0/9] sparse-checkout: make cone mode the default Derrick Stolee

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=xmqqa6dsp78q.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=lessleydennington@gmail.com \
    --cc=newren@gmail.com \
    --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).