3 test_description='stash --pathspec-from-file'
9 test_expect_success setup '
14 git add fileA.t fileB.t fileC.t fileD.t &&
15 git commit -m "Files" &&
20 restore_checkpoint () {
21 git reset --hard checkpoint
25 git stash show --name-status >actual &&
26 test_cmp expect actual
29 test_expect_success 'simplest' '
32 # More files are written to make sure that git didnt ignore
33 # --pathspec-from-file, stashing everything
39 cat >expect <<-\EOF &&
43 echo fileA.t | git stash push --pathspec-from-file=- &&
47 test_expect_success '--pathspec-file-nul' '
50 # More files are written to make sure that git didnt ignore
51 # --pathspec-from-file, stashing everything
57 cat >expect <<-\EOF &&
62 printf "fileA.t\0fileB.t\0" | git stash push --pathspec-from-file=- --pathspec-file-nul &&
66 test_expect_success 'only touches what was listed' '
69 # More files are written to make sure that git didnt ignore
70 # --pathspec-from-file, stashing everything
76 cat >expect <<-\EOF &&
81 printf "fileB.t\nfileC.t\n" | git stash push --pathspec-from-file=- &&
85 test_expect_success 'error conditions' '
90 test_must_fail git stash push --pathspec-from-file=list --patch 2>err &&
91 test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err &&
93 test_must_fail git stash push --pathspec-from-file=list -- fileA.t 2>err &&
94 test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
96 test_must_fail git stash push --pathspec-file-nul 2>err &&
97 test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err