Merge branch 'en/test-cleanup'
[alt-git.git] / t / t3906-stash-submodule.sh
blobb93d1d74da7b41c51ba483fc015ac56f13799341
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 git read-tree -u -m "$1" &&
12 git stash &&
13 git status -su >actual &&
14 ls -1pR * >>actual &&
15 test_cmp expect actual &&
16 git stash apply
19 KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES=1
20 KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
21 KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
22 test_submodule_switch "git_stash"
24 setup_basic () {
25 test_when_finished "rm -rf main sub" &&
26 git init sub &&
28 cd sub &&
29 test_commit sub_file
30 ) &&
31 git init main &&
33 cd main &&
34 git submodule add ../sub &&
35 test_commit main_file
39 test_expect_success 'stash push with submodule.recurse=true preserves dirty submodule worktree' '
40 setup_basic &&
42 cd main &&
43 git config submodule.recurse true &&
44 echo "x" >main_file.t &&
45 echo "y" >sub/sub_file.t &&
46 git stash push &&
47 test_must_fail git -C sub diff --quiet
51 test_expect_success 'stash push and pop with submodule.recurse=true preserves dirty submodule worktree' '
52 setup_basic &&
54 cd main &&
55 git config submodule.recurse true &&
56 echo "x" >main_file.t &&
57 echo "y" >sub/sub_file.t &&
58 git stash push &&
59 git stash pop &&
60 test_must_fail git -C sub diff --quiet
64 test_done