3 test_description
='submodule --cached, --quiet etc. output'
5 TEST_PASSES_SANITIZE_LEAK
=true
7 .
"$TEST_DIRECTORY"/lib-t3100.sh
12 git $@ clone .
"$d" &&
13 git $@ submodule add .
/"$d"
17 sed -e 's/-g[0-9a-f]*/-gHASH/'
20 test_expect_success
'setup' '
33 GIT_ALLOW_PROTOCOL=file git -C X submodule update --init &&
38 echo dirty >"$d"/A.t || return 1
41 # commit (for --cached)
44 git -C "$d" reset --hard A || return 1
50 echo dirty >"$d/C2.t" || return 1
55 # Not different with SHA-1 and SHA-256, just (ab)using
56 # test_oid_cache as a variable bag to avoid using
57 # $(git rev-parse ...).
58 oid=$(git rev-parse $ref) &&
59 test_oid_cache <<-EOF || return 1
66 for opts
in "" "status"
68 test_expect_success
"git submodule $opts" '
69 sed -e "s/^>//" >expect <<-EOF &&
71 >+$(test_oid A) S.C (A)
72 >+$(test_oid A) S.C.D (A)
73 > $(test_oid B) S.D (B)
76 git submodule $opts >actual.raw &&
77 normalize_status <actual.raw >actual &&
78 test_cmp expect actual
85 test_expect_success
"git submodule $opts" '
86 sed -e "s/^>//" >expect <<-EOF &&
88 >+$(test_oid A) S.C (A)
89 >+$(test_oid A) S.C.D (A)
90 > $(test_oid B) S.D (B)
92 > $(test_oid B) X/S (B)
93 >+$(test_oid A) X/S.C (A)
94 >+$(test_oid A) X/S.C.D (A)
95 > $(test_oid B) X/S.D (B)
96 > $(test_oid B) X/X (B)
98 git submodule $opts >actual.raw &&
99 normalize_status <actual.raw >actual &&
100 test_cmp expect actual
109 test_expect_success
"git submodule $opts" '
110 git submodule $opts >out &&
111 test_must_be_empty out
120 test_expect_success
"git submodule $opts" '
121 sed -e "s/^>//" >expect <<-EOF &&
122 > $(test_oid B) S (B)
123 >+$(test_oid B) S.C (B)
124 >+$(test_oid B) S.C.D (B)
125 > $(test_oid B) S.D (B)
126 >+$(test_oid B) X (B)
128 git submodule $opts >actual.raw &&
129 normalize_status <actual.raw >actual &&
130 test_cmp expect actual
136 "--cached --quiet status" \
137 "--cached status --quiet" \
138 "--quiet status --cached" \
139 "status --cached --quiet"
141 test_expect_success
"git submodule $opts" '
142 git submodule $opts >out &&
143 test_must_be_empty out
148 "status --cached --recursive" \
149 "--cached status --recursive"
151 test_expect_success
"git submodule $opts" '
152 sed -e "s/^>//" >expect <<-EOF &&
153 > $(test_oid B) S (B)
154 >+$(test_oid B) S.C (B)
155 >+$(test_oid B) S.C.D (B)
156 > $(test_oid B) S.D (B)
157 >+$(test_oid B) X (B)
158 > $(test_oid B) X/S (B)
159 >+$(test_oid B) X/S.C (B)
160 >+$(test_oid B) X/S.C.D (B)
161 > $(test_oid B) X/S.D (B)
162 > $(test_oid B) X/X (B)
164 git submodule $opts >actual.raw &&
165 normalize_status <actual.raw >actual &&
166 test_cmp expect actual