Skip to content

Commit d73db00

Browse files
committed
Merge branch 'en/sparse-checkout-eoo'
"git sparse-checkout (add|set) --[no-]cone --end-of-options" did not handle "--end-of-options" correctly after a recent update. * en/sparse-checkout-eoo: sparse-checkout: be consistent with end of options markers
2 parents 863c596 + f8ab66f commit d73db00

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

builtin/sparse-checkout.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,7 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
773773

774774
argc = parse_options(argc, argv, prefix,
775775
builtin_sparse_checkout_add_options,
776-
builtin_sparse_checkout_add_usage,
777-
PARSE_OPT_KEEP_UNKNOWN_OPT);
776+
builtin_sparse_checkout_add_usage, 0);
778777

779778
sanitize_paths(argc, argv, prefix, add_opts.skip_checks);
780779

@@ -820,8 +819,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
820819

821820
argc = parse_options(argc, argv, prefix,
822821
builtin_sparse_checkout_set_options,
823-
builtin_sparse_checkout_set_usage,
824-
PARSE_OPT_KEEP_UNKNOWN_OPT);
822+
builtin_sparse_checkout_set_usage, 0);
825823

826824
if (update_modes(&set_opts.cone_mode, &set_opts.sparse_index))
827825
return 1;
@@ -992,8 +990,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
992990

993991
argc = parse_options(argc, argv, prefix,
994992
builtin_sparse_checkout_check_rules_options,
995-
builtin_sparse_checkout_check_rules_usage,
996-
PARSE_OPT_KEEP_UNKNOWN_OPT);
993+
builtin_sparse_checkout_check_rules_usage, 0);
997994

998995
if (check_rules_opts.rules_file && check_rules_opts.cone_mode < 0)
999996
check_rules_opts.cone_mode = 1;

t/t1091-sparse-checkout-builtin.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ test_expect_success 'cone mode: set with nested folders' '
334334

335335
test_expect_success 'cone mode: add independent path' '
336336
git -C repo sparse-checkout set deep/deeper1 &&
337-
git -C repo sparse-checkout add folder1 &&
337+
git -C repo sparse-checkout add --end-of-options folder1 &&
338338
cat >expect <<-\EOF &&
339339
/*
340340
!/*/
@@ -886,6 +886,12 @@ test_expect_success 'by default, cone mode will error out when passed files' '
886886
grep ".gitignore.*is not a directory" error
887887
'
888888

889+
test_expect_success 'error on mistyped command line options' '
890+
test_must_fail git -C repo sparse-checkout add --sikp-checks .gitignore 2>error &&
891+
892+
grep "unknown option.*sikp-checks" error
893+
'
894+
889895
test_expect_success 'by default, non-cone mode will warn on individual files' '
890896
git -C repo sparse-checkout reapply --no-cone &&
891897
git -C repo sparse-checkout add .gitignore 2>warning &&

0 commit comments

Comments
 (0)