gitignore.txt: use backticks instead of double quotes
[git/debian.git] / t / t3906-stash-submodule.sh
blob0f7348ec21b8821cb6b7594919bbc637ec0a7236
1 #!/bin/sh
3 test_description='stash can handle submodules'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-submodule-update.sh
8 git_stash () {
9 git status -su >expect &&
10 ls -1pR * >>expect &&
11 may_only_be_test_must_fail "$2" &&
12 $2 git read-tree -u -m "$1" &&
13 if test -n "$2"
14 then
15 return
16 fi &&
17 git stash &&
18 git status -su >actual &&
19 ls -1pR * >>actual &&
20 test_cmp expect actual &&
21 git stash apply
24 KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES=1
25 KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
26 KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
27 test_submodule_switch_func "git_stash"
29 setup_basic () {
30 test_when_finished "rm -rf main sub" &&
31 git init sub &&
33 cd sub &&
34 test_commit sub_file
35 ) &&
36 git init main &&
38 cd main &&
39 git -c protocol.file.allow=always submodule add ../sub &&
40 test_commit main_file
44 test_expect_success 'stash push with submodule.recurse=true preserves dirty submodule worktree' '
45 setup_basic &&
47 cd main &&
48 git config submodule.recurse true &&
49 echo "x" >main_file.t &&
50 echo "y" >sub/sub_file.t &&
51 git stash push &&
52 test_must_fail git -C sub diff --quiet
56 test_expect_success 'stash push and pop with submodule.recurse=true preserves dirty submodule worktree' '
57 setup_basic &&
59 cd main &&
60 git config submodule.recurse true &&
61 echo "x" >main_file.t &&
62 echo "y" >sub/sub_file.t &&
63 git stash push &&
64 git stash pop &&
65 test_must_fail git -C sub diff --quiet
69 test_done