Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1090-sparse-checkout-scope.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1090-sparse-checkout-scope.sh` 109 lines ยท 2790 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='sparse checkout scope tests' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 TEST_CREATE_REPO_NO_TEMPLATE=1 9 . ./test-lib.sh 10 11 test_expect_success 'setup' ' 12 echo "initial" >a && 13 echo "initial" >b && 14 echo "initial" >c && 15 git add a b c && 16 git commit -m "initial commit" 17 ' 18 19 test_expect_success 'create feature branch' ' 20 git checkout -b feature && 21 echo "modified" >b && 22 echo "modified" >c && 23 git add b c && 24 git commit -m "modification" 25 ' 26 27 test_expect_success 'perform sparse checkout of main' ' 28 git config --local --bool core.sparsecheckout true && 29 mkdir .git/info && 30 echo "!/*" >.git/info/sparse-checkout && 31 echo "/a" >>.git/info/sparse-checkout && 32 echo "/c" >>.git/info/sparse-checkout && 33 git checkout main && 34 test_path_is_file a && 35 test_path_is_missing b && 36 test_path_is_file c 37 ' 38 39 test_expect_success 'merge feature branch into sparse checkout of main' ' 40 git merge feature && 41 test_path_is_file a && 42 test_path_is_missing b && 43 test_path_is_file c && 44 test "$(cat c)" = "modified" 45 ' 46 47 test_expect_success 'return to full checkout of main' ' 48 git checkout feature && 49 echo "/*" >.git/info/sparse-checkout && 50 git checkout main && 51 test_path_is_file a && 52 test_path_is_file b && 53 test_path_is_file c && 54 test "$(cat b)" = "modified" 55 ' 56 57 test_expect_success 'skip-worktree on files outside sparse patterns' ' 58 git sparse-checkout disable && 59 git sparse-checkout set --no-cone "a*" && 60 git checkout-index --all --ignore-skip-worktree-bits && 61 62 git ls-files -t >output && 63 ! grep ^S output >actual && 64 test_must_be_empty actual && 65 66 test_config sparse.expectFilesOutsideOfPatterns true && 67 cat <<-\EOF >expect && 68 S b 69 S c 70 EOF 71 git ls-files -t >output && 72 grep ^S output >actual && 73 test_cmp expect actual 74 ' 75 76 test_expect_success 'in partial clone, sparse checkout only fetches needed blobs' ' 77 test_create_repo server && 78 git clone --template= "file://$(pwd)/server" client && 79 80 test_config -C server uploadpack.allowfilter 1 && 81 test_config -C server uploadpack.allowanysha1inwant 1 && 82 echo a >server/a && 83 echo bb >server/b && 84 mkdir server/c && 85 echo ccc >server/c/c && 86 git -C server add a b c/c && 87 git -C server commit -m message && 88 89 test_config -C client core.sparsecheckout 1 && 90 mkdir client/.git/info && 91 echo "!/*" >client/.git/info/sparse-checkout && 92 echo "/a" >>client/.git/info/sparse-checkout && 93 git -C client fetch --filter=blob:none origin && 94 git -C client checkout FETCH_HEAD && 95 96 git -C client rev-list HEAD \ 97 --quiet --objects --missing=print >unsorted_actual && 98 ( 99 printf "?" && 100 git hash-object server/b && 101 printf "?" && 102 git hash-object server/c/c 103 ) >unsorted_expect && 104 sort unsorted_actual >actual && 105 sort unsorted_expect >expect && 106 test_cmp expect actual 107 ' 108 109 test_done