From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>
Subject: [PATCH 2/3] sparse-checkout: use default patterns for 'set' only !stdin
Date: Wed, 20 Dec 2023 22:59:24 -0800 [thread overview]
Message-ID: <20231221065925.3234048-3-gitster@pobox.com> (raw)
In-Reply-To: <20231221065925.3234048-1-gitster@pobox.com>
"git sparse-checkout set ---no-cone" uses default patterns when none
is given from the command line, but it should do so ONLY when
--stdin is not being used. Right now, add_patterns_from_input()
called when reading from the standard input is sloppy and does not
check if there are extra command line parameters that the command
will silently ignore, but that will change soon and not setting this
unnecessary and unused default patterns start to matter when it gets
fixed.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This came from f2e3a218 (sparse-checkout: enable `set` to
initialize sparse-checkout mode, 2021-12-14) by Elijah.
builtin/sparse-checkout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 8f55127202..04ae81fce8 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -837,7 +837,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
* non-cone mode, if nothing is specified, manually select just the
* top-level directory (much as 'init' would do).
*/
- if (!core_sparse_checkout_cone && argc == 0) {
+ if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
argv = default_patterns;
argc = default_patterns_nr;
} else {
--
2.43.0-174-g055bb6e996
next prev parent reply other threads:[~2023-12-21 6:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 6:59 [PATCH 0/3] sparse-checkout with --end-of-options Junio C Hamano
2023-12-21 6:59 ` [PATCH 1/3] sparse-checkout: take care of "--end-of-options" in set/add/check-rules Junio C Hamano
2023-12-24 7:53 ` Elijah Newren
2023-12-21 6:59 ` Junio C Hamano [this message]
2023-12-24 7:51 ` [PATCH 2/3] sparse-checkout: use default patterns for 'set' only !stdin Elijah Newren
2023-12-28 0:18 ` Junio C Hamano
2023-12-21 6:59 ` [PATCH 3/3] sparse-checkout: tighten add_patterns_from_input() 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=20231221065925.3234048-3-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=newren@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).