3 test_description
='git status for submodule'
7 test_expect_success
'setup' '
8 test_create_repo sub &&
13 git commit -m " Add bar" &&
16 git commit -m " Add foo"
18 echo output > .gitignore &&
19 git add sub .gitignore &&
20 git commit -m "Add submodule sub"
23 test_expect_success
'status clean' '
25 grep "nothing to commit" output
28 test_expect_success
'commit --dry-run -a clean' '
29 test_must_fail git commit --dry-run -a >output &&
30 grep "nothing to commit" output
33 test_expect_success
'status with modified file in submodule' '
34 (cd sub && git reset --hard) &&
35 echo "changed" >sub/foo &&
37 grep "modified: sub" output
40 test_expect_success
'status with modified file in submodule (porcelain)' '
41 (cd sub && git reset --hard) &&
42 echo "changed" >sub/foo &&
43 git status --porcelain >output &&
49 test_expect_success
'status with added file in submodule' '
50 (cd sub && git reset --hard && echo >foo && git add foo) &&
52 grep "modified: sub" output
55 test_expect_success
'status with added file in submodule (porcelain)' '
56 (cd sub && git reset --hard && echo >foo && git add foo) &&
57 git status --porcelain >output &&
63 test_expect_success
'status with untracked file in submodule' '
64 (cd sub && git reset --hard) &&
65 echo "content" >sub/new-file &&
67 grep "modified: sub" output
70 test_expect_success
'status with untracked file in submodule (porcelain)' '
71 git status --porcelain >output &&
77 test_expect_success
'rm submodule contents' '
81 test_expect_success
'status clean (empty submodule dir)' '
83 grep "nothing to commit" output
86 test_expect_success
'status -a clean (empty submodule dir)' '
87 test_must_fail git commit --dry-run -a >output &&
88 grep "nothing to commit" output