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/t3601-rm-pathspec-file.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 / t3601-rm-pathspec-file.sh` 79 lines ยท 1638 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='rm --pathspec-from-file' 4 5 . ./test-lib.sh 6 7 test_tick 8 9 test_expect_success setup ' 10 echo A >fileA.t && 11 echo B >fileB.t && 12 echo C >fileC.t && 13 echo D >fileD.t && 14 git add fileA.t fileB.t fileC.t fileD.t && 15 git commit -m "files" && 16 17 git tag checkpoint 18 ' 19 20 restore_checkpoint () { 21 git reset --hard checkpoint 22 } 23 24 verify_expect () { 25 git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual && 26 test_cmp expect actual 27 } 28 29 test_expect_success 'simplest' ' 30 restore_checkpoint && 31 32 cat >expect <<-\EOF && 33 D fileA.t 34 EOF 35 36 echo fileA.t | git rm --pathspec-from-file=- && 37 verify_expect 38 ' 39 40 test_expect_success '--pathspec-file-nul' ' 41 restore_checkpoint && 42 43 cat >expect <<-\EOF && 44 D fileA.t 45 D fileB.t 46 EOF 47 48 printf "fileA.t\0fileB.t\0" | git rm --pathspec-from-file=- --pathspec-file-nul && 49 verify_expect 50 ' 51 52 test_expect_success 'only touches what was listed' ' 53 restore_checkpoint && 54 55 cat >expect <<-\EOF && 56 D fileB.t 57 D fileC.t 58 EOF 59 60 printf "fileB.t\nfileC.t\n" | git rm --pathspec-from-file=- && 61 verify_expect 62 ' 63 64 test_expect_success 'error conditions' ' 65 restore_checkpoint && 66 echo fileA.t >list && 67 68 test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err && 69 test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && 70 71 test_must_fail git rm --pathspec-file-nul 2>err && 72 test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && 73 74 >empty_list && 75 test_must_fail git rm --pathspec-from-file=empty_list 2>err && 76 test_grep -e "No pathspec was given. Which files should I remove?" err 77 ' 78 79 test_done