]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3906-stash-submodule.sh
Merge branch 'en/merge-recursive-directory-rename-fixes'
[thirdparty/git.git] / t / t3906-stash-submodule.sh
CommitLineData
da7fe3fb
JL
1#!/bin/sh
2
556895d0 3test_description='stash can handle submodules'
da7fe3fb
JL
4
5. ./test-lib.sh
6. "$TEST_DIRECTORY"/lib-submodule-update.sh
7
8git_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
17}
18
19KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES=1
20KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
21KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
22test_submodule_switch "git_stash"
23
556895d0
JJ
24setup_basic () {
25 test_when_finished "rm -rf main sub" &&
26 git init sub &&
27 (
28 cd sub &&
29 test_commit sub_file
30 ) &&
31 git init main &&
32 (
33 cd main &&
34 git submodule add ../sub &&
35 test_commit main_file
36 )
37}
38
39test_expect_success 'stash push with submodule.recurse=true preserves dirty submodule worktree' '
40 setup_basic &&
41 (
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
48 )
49'
50
51test_expect_success 'stash push and pop with submodule.recurse=true preserves dirty submodule worktree' '
52 setup_basic &&
53 (
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
61 )
62'
63
da7fe3fb 64test_done