Thread (57 messages) 57 messages, 5 authors, 2022-02-20

Re: [PATCH v2 4/6] sparse-checkout: error or warn when given individual files

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-02-17 09:11:49

On Tue, Feb 15 2022, Elijah Newren via GitGitGadget wrote:
From: Elijah Newren <redacted>
+		if (core_sparse_checkout_cone)
+			die(_("\"%s\" is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), argv[i]);
Almost all of our messaging quotes paths etc. with single quotes, which
also makes this nicer in the C code:

	die(_("'%s' is not a ...
+		else
+			warning(_("pass a leading slash before paths such as \"%s\" if you want a single file (see NON-CONE PROBLEMS in the git-sparse-checkout manual)."), argv[i]);
ditto.
 	static struct option builtin_sparse_checkout_add_options[] = {
+		OPT_BOOL_F(0, "skip-checks", &add_opts.skip_checks,
+			   N_("skip some sanity checks on the given paths that might give false positives"),
+			   PARSE_OPT_NONEG),
This is bikeshedding, but I dislike arguments whose long name requires
us to have a PARSE_OPT_NONEG. Or well, not requires, but
--no-skip-checks sounds odd, so it's disallowed here.

Why not simply have a --check-path, --path-checks or --sanity-check, all
of which combine more naturally with a --no than not.

I.e. set the variable to a default of 1, and let the user negate it.

I think that also makes the synopsis easier to grok at first sight,
since a:

    git x [--no-XYZ]

Makes it immediately clear what the default is. Well, I suppose
"--skip-*" does too, but we use --no-* more.

Another reason to do that is that if you do:

    git cmd --no-<TAB>

You can see all the knobs that are off by default, our completion
supports that specifically.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help