diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index c8ad302e1aa5d1..a0c8a1499afae1 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -735,7 +735,7 @@ static void sanitize_paths(int argc, const char **argv, if (core_sparse_checkout_cone) die(_("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), argv[i]); else - die(_("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]); + 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]); } } diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh index 770610eba816c8..421127d99c2c6c 100755 --- a/t/t1091-sparse-checkout-builtin.sh +++ b/t/t1091-sparse-checkout-builtin.sh @@ -387,7 +387,7 @@ test_expect_success 'revert to old sparse-checkout on empty update' ' git sparse-checkout set nothing 2>err && test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err && test_i18ngrep ! ".git/index.lock" err && - git sparse-checkout set /file + git sparse-checkout set file ) ' @@ -848,9 +848,9 @@ test_expect_success 'by default, cone mode will error out when passed files' ' test_expect_success 'by default, non-cone mode will warn on individual files' ' git -C repo sparse-checkout reapply --no-cone && - test_must_fail git -C repo sparse-checkout add .gitignore 2>error && + git -C repo sparse-checkout add .gitignore 2>warning && - grep "pass a leading slash before paths.*if you want a single file" error + grep "pass a leading slash before paths.*if you want a single file" warning ' test_done diff --git a/t/t3602-rm-sparse-checkout.sh b/t/t3602-rm-sparse-checkout.sh index 4bd2895206a83f..034ec010910c16 100755 --- a/t/t3602-rm-sparse-checkout.sh +++ b/t/t3602-rm-sparse-checkout.sh @@ -30,7 +30,7 @@ test_expect_success 'setup' " for opt in "" -f --dry-run do test_expect_success "rm${opt:+ $opt} does not remove sparse entries" ' - git sparse-checkout set /a && + git sparse-checkout set a && test_must_fail git rm $opt b 2>stderr && test_cmp b_error_and_hint stderr && git ls-files --error-unmatch b @@ -70,14 +70,14 @@ test_expect_success 'recursive rm --sparse removes sparse entries' ' test_expect_success 'rm obeys advice.updateSparsePath' ' git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && test_must_fail git -c advice.updateSparsePath=false rm b 2>stderr && test_cmp sparse_entry_b_error stderr ' test_expect_success 'do not advice about sparse entries when they do not match the pathspec' ' git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && test_must_fail git rm nonexistent 2>stderr && grep "fatal: pathspec .nonexistent. did not match any files" stderr && ! grep -F -f sparse_error_header stderr @@ -85,7 +85,7 @@ test_expect_success 'do not advice about sparse entries when they do not match t test_expect_success 'do not warn about sparse entries when pathspec matches dense entries' ' git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && git rm "[ba]" 2>stderr && test_must_be_empty stderr && git ls-files --error-unmatch b && @@ -94,7 +94,7 @@ test_expect_success 'do not warn about sparse entries when pathspec matches dens test_expect_success 'do not warn about sparse entries with --ignore-unmatch' ' git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && git rm --ignore-unmatch b 2>stderr && test_must_be_empty stderr && git ls-files --error-unmatch b @@ -102,7 +102,7 @@ test_expect_success 'do not warn about sparse entries with --ignore-unmatch' ' test_expect_success 'refuse to rm a non-skip-worktree path outside sparse cone' ' git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && git update-index --no-skip-worktree b && test_must_fail git rm b 2>stderr && test_cmp b_error_and_hint stderr && diff --git a/t/t6428-merge-conflicts-sparse.sh b/t/t6428-merge-conflicts-sparse.sh index 6dd7b073bc7886..7e8bf497f821da 100755 --- a/t/t6428-merge-conflicts-sparse.sh +++ b/t/t6428-merge-conflicts-sparse.sh @@ -87,7 +87,7 @@ test_expect_success 'conflicting entries written to worktree even if sparse' ' test_path_is_file numerals && git sparse-checkout init && - git sparse-checkout set /README && + git sparse-checkout set README && test_path_is_file README && test_path_is_missing numerals && @@ -123,7 +123,7 @@ test_expect_merge_algorithm failure success 'present-despite-SKIP_WORKTREE handl test_path_is_file numerals && git sparse-checkout init && - git sparse-checkout set /README && + git sparse-checkout set README && test_path_is_file README && test_path_is_missing numerals && diff --git a/t/t7002-mv-sparse-checkout.sh b/t/t7002-mv-sparse-checkout.sh index 63ad7c087c84b9..1d3d2aca21c70e 100755 --- a/t/t7002-mv-sparse-checkout.sh +++ b/t/t7002-mv-sparse-checkout.sh @@ -27,7 +27,7 @@ test_expect_success 'setup' " test_expect_success 'mv refuses to move sparse-to-sparse' ' test_when_finished rm -f e && git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && touch b && test_must_fail git mv b e 2>stderr && cat sparse_error_header >expect && @@ -42,7 +42,7 @@ test_expect_success 'mv refuses to move sparse-to-sparse' ' test_expect_success 'mv refuses to move sparse-to-sparse, ignores failure' ' test_when_finished rm -f b c e && git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && # tracked-to-untracked touch b && @@ -81,7 +81,7 @@ test_expect_success 'mv refuses to move sparse-to-sparse, ignores failure' ' test_expect_success 'mv refuses to move non-sparse-to-sparse' ' test_when_finished rm -f b c e && git reset --hard && - git sparse-checkout set /a && + git sparse-checkout set a && # tracked-to-untracked test_must_fail git mv a e 2>stderr && @@ -115,7 +115,7 @@ test_expect_success 'mv refuses to move non-sparse-to-sparse' ' test_expect_success 'mv refuses to move sparse-to-non-sparse' ' test_when_finished rm -f b c e && git reset --hard && - git sparse-checkout set /a e && + git sparse-checkout set a e && # tracked-to-untracked touch b && @@ -187,7 +187,7 @@ test_expect_success 'recursive mv refuses to move sparse' ' test_expect_success 'can move files to non-sparse dir' ' git reset --hard && git sparse-checkout init --no-cone && - git sparse-checkout set /a /b /c /w !/x y/ && + git sparse-checkout set a b c w !/x y/ && mkdir -p w x/y && git mv a w/new-a 2>stderr && @@ -198,7 +198,7 @@ test_expect_success 'can move files to non-sparse dir' ' test_expect_success 'refuse to move file to non-skip-worktree sparse path' ' git reset --hard && git sparse-checkout init --no-cone && - git sparse-checkout set /a !/x y/ !x/y/z && + git sparse-checkout set a !/x y/ !x/y/z && mkdir -p x/y/z && test_must_fail git mv a x/y/z/new-a 2>stderr && diff --git a/t/t7817-grep-sparse-checkout.sh b/t/t7817-grep-sparse-checkout.sh index e58b5a75fbcd25..590b99bbb6f7bb 100755 --- a/t/t7817-grep-sparse-checkout.sh +++ b/t/t7817-grep-sparse-checkout.sh @@ -66,7 +66,7 @@ test_expect_success 'setup' ' git add a b dir && git commit -m super && git sparse-checkout init --no-cone && - git sparse-checkout set "/*" "!b" "!/*/" "/sub" && + git sparse-checkout set "/*" "!b" "!/*/" "sub" && git tag -am tag-to-commit tag-to-commit HEAD && tree=$(git rev-parse HEAD^{tree}) &&