t1016: clean up style

Adhere to Documentation/CodingGuidelines: - Whitespace and redirect operator. - Case arms indentation. - Tabs for indentation. Signed-off-by: Andrew Kreimer <algonell@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Andrew Kreimer committed Nov 3, 2024 at 15:50 UTC a1fb77fcb8865e3d878baa88227c1a6e9d1dc398
1 file changed +130 -132
t/t1016-compatObjectFormat.sh
+130 -132
@@ -24,84 +24,83 @@ TEST_PASSES_SANITIZE_LEAK=true
24 # the commit is identical to the commit in the other repository.
25
26 compat_hash () {
27 - case "$1" in
28 - "sha1")
29 - echo "sha256"
30 - ;;
31 - "sha256")
32 - echo "sha1"
33 - ;;
34 - esac
27 + case "$1" in
28 + "sha1")
29 + echo "sha256"
30 + ;;
31 + "sha256")
32 + echo "sha1"
33 + ;;
34 + esac
35 }
36
37 hello_oid () {
38 - case "$1" in
39 - "sha1")
40 - echo "$hello_sha1_oid"
41 - ;;
42 - "sha256")
43 - echo "$hello_sha256_oid"
44 - ;;
45 - esac
38 + case "$1" in
39 + "sha1")
40 + echo "$hello_sha1_oid"
41 + ;;
42 + "sha256")
43 + echo "$hello_sha256_oid"
44 + ;;
45 + esac
46 }
47
48 tree_oid () {
49 - case "$1" in
50 - "sha1")
51 - echo "$tree_sha1_oid"
52 - ;;
53 - "sha256")
54 - echo "$tree_sha256_oid"
55 - ;;
56 - esac
49 + case "$1" in
50 + "sha1")
51 + echo "$tree_sha1_oid"
52 + ;;
53 + "sha256")
54 + echo "$tree_sha256_oid"
55 + ;;
56 + esac
57 }
58
59 commit_oid () {
60 - case "$1" in
61 - "sha1")
62 - echo "$commit_sha1_oid"
63 - ;;
64 - "sha256")
65 - echo "$commit_sha256_oid"
66 - ;;
67 - esac
60 + case "$1" in
61 + "sha1")
62 + echo "$commit_sha1_oid"
63 + ;;
64 + "sha256")
65 + echo "$commit_sha256_oid"
66 + ;;
67 + esac
68 }
69
70 commit2_oid () {
71 - case "$1" in
72 - "sha1")
73 - echo "$commit2_sha1_oid"
74 - ;;
75 - "sha256")
76 - echo "$commit2_sha256_oid"
77 - ;;
78 - esac
71 + case "$1" in
72 + "sha1")
73 + echo "$commit2_sha1_oid"
74 + ;;
75 + "sha256")
76 + echo "$commit2_sha256_oid"
77 + ;;
78 + esac
79 }
80
81 del_sigcommit () {
82 - local delete="$1"
83 -
84 - if test "$delete" = "sha256" ; then
85 - local pattern="gpgsig-sha256"
86 - else
87 - local pattern="gpgsig"
88 - fi
89 - test-tool delete-gpgsig "$pattern"
82 + local delete="$1"
83 +
84 + if test "$delete" = "sha256" ; then
85 + local pattern="gpgsig-sha256"
86 + else
87 + local pattern="gpgsig"
88 + fi
89 + test-tool delete-gpgsig "$pattern"
90 }
91
92 -
92 del_sigtag () {
94 - local storage="$1"
95 - local delete="$2"
96 -
97 - if test "$storage" = "$delete" ; then
98 - local pattern="trailer"
99 - elif test "$storage" = "sha256" ; then
100 - local pattern="gpgsig"
101 - else
102 - local pattern="gpgsig-sha256"
103 - fi
104 - test-tool delete-gpgsig "$pattern"
93 + local storage="$1"
94 + local delete="$2"
95 +
96 + if test "$storage" = "$delete" ; then
97 + local pattern="trailer"
98 + elif test "$storage" = "sha256" ; then
99 + local pattern="gpgsig"
100 + else
101 + local pattern="gpgsig-sha256"
102 + fi
103 + test-tool delete-gpgsig "$pattern"
104 }
105
106 base=$(pwd)
@@ -146,9 +145,9 @@ do
145 '
146 test_expect_success "create a $hash branch" '
147 git checkout -b branch $(commit_oid $hash) &&
149 - echo "More more more give me more!" > more &&
148 + echo "More more more give me more!" >more &&
149 eval more_${hash}_oid=$(git hash-object more) &&
151 - echo "Another and another and another" > another &&
150 + echo "Another and another and another" >another &&
151 eval another_${hash}_oid=$(git hash-object another) &&
152 git update-index --add more another &&
153 git commit -m "Add more files!" &&
@@ -165,15 +164,15 @@ do
164 '
165 test_expect_success GPG2 "create additional $hash signed commits" '
166 git commit --gpg-sign --allow-empty -m "This is an additional signed commit" &&
168 - git cat-file commit HEAD | del_sigcommit sha256 > "../${hash}_signedcommit3" &&
169 - git cat-file commit HEAD | del_sigcommit sha1 > "../${hash}_signedcommit4" &&
167 + git cat-file commit HEAD | del_sigcommit sha256 >"../${hash}_signedcommit3" &&
168 + git cat-file commit HEAD | del_sigcommit sha1 >"../${hash}_signedcommit4" &&
169 eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
170 eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
171 '
172 test_expect_success GPG2 "create additional $hash signed tags" '
173 git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
175 - git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 > ../${hash}_signedtag3 &&
176 - git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 > ../${hash}_signedtag4 &&
174 + git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >../${hash}_signedtag3 &&
175 + git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >../${hash}_signedtag4 &&
176 eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
177 eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
178 '
@@ -181,81 +180,80 @@ done
180 cd "$base"
181
182 compare_oids () {
184 - test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
185 - local type="$1"
186 - local name="$2"
187 - local sha1_oid="$3"
188 - local sha256_oid="$4"
189 -
190 - echo ${sha1_oid} > ${name}_sha1_expected
191 - echo ${sha256_oid} > ${name}_sha256_expected
192 - echo ${type} > ${name}_type_expected
193 -
194 - git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name}_sha1_sha256_found
195 - git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
196 - local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
197 - local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
198 -
199 - test_expect_success $PREREQ "Verify ${type} ${name}'s sha1 oid" '
200 - git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha1 &&
201 - test_cmp ${name}_sha1 ${name}_sha1_expected
202 -'
203 -
204 - test_expect_success $PREREQ "Verify ${type} ${name}'s sha256 oid" '
205 - git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name}_sha256 &&
206 - test_cmp ${name}_sha256 ${name}_sha256_expected
207 -'
183 + test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
184 + local type="$1"
185 + local name="$2"
186 + local sha1_oid="$3"
187 + local sha256_oid="$4"
188 +
189 + echo ${sha1_oid} >${name}_sha1_expected
190 + echo ${sha256_oid} >${name}_sha256_expected
191 + echo ${type} >${name}_type_expected
192 +
193 + git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} >${name}_sha1_sha256_found
194 + git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha256_sha1_found
195 + local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
196 + local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
197 +
198 + test_expect_success $PREREQ "Verify ${type} ${name}'s sha1 oid" '
199 + git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha1 &&
200 + test_cmp ${name}_sha1 ${name}_sha1_expected
201 + '
202
209 - test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
210 - git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} > ${name}_type1 &&
211 - git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} > ${name}_type2 &&
212 - test_cmp ${name}_type1 ${name}_type2 &&
213 - test_cmp ${name}_type1 ${name}_type_expected
214 -'
203 + test_expect_success $PREREQ "Verify ${type} ${name}'s sha256 oid" '
204 + git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} >${name}_sha256 &&
205 + test_cmp ${name}_sha256 ${name}_sha256_expected
206 + '
207
216 - test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
217 - git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} > ${name}_type3 &&
218 - git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} > ${name}_type4 &&
219 - test_cmp ${name}_type3 ${name}_type4 &&
220 - test_cmp ${name}_type3 ${name}_type_expected
221 -'
208 + test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
209 + git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} >${name}_type1 &&
210 + git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} >${name}_type2 &&
211 + test_cmp ${name}_type1 ${name}_type2 &&
212 + test_cmp ${name}_type1 ${name}_type_expected
213 + '
214
223 - test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
224 - git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} > ${name}_size1 &&
225 - git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} > ${name}_size2 &&
226 - test_cmp ${name}_size1 ${name}_size2
227 -'
215 + test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
216 + git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} >${name}_type3 &&
217 + git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} >${name}_type4 &&
218 + test_cmp ${name}_type3 ${name}_type4 &&
219 + test_cmp ${name}_type3 ${name}_type_expected
220 + '
221
229 - test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
230 - git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid} > ${name}_size3 &&
231 - git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid} > ${name}_size4 &&
232 - test_cmp ${name}_size3 ${name}_size4
233 -'
222 + test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
223 + git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} >${name}_size1 &&
224 + git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} >${name}_size2 &&
225 + test_cmp ${name}_size1 ${name}_size2
226 + '
227
235 - test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content" '
236 - git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid} > ${name}_content1 &&
237 - git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid} > ${name}_content2 &&
238 - test_cmp ${name}_content1 ${name}_content2
239 -'
228 + test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
229 + git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid} >${name}_size3 &&
230 + git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid} >${name}_size4 &&
231 + test_cmp ${name}_size3 ${name}_size4
232 + '
233
241 - test_expect_success $PREREQ "Verify ${name}'s sha256 pretty content" '
242 - git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid} > ${name}_content3 &&
243 - git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid} > ${name}_content4 &&
244 - test_cmp ${name}_content3 ${name}_content4
245 -'
234 + test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content" '
235 + git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid} >${name}_content1 &&
236 + git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid} >${name}_content2 &&
237 + test_cmp ${name}_content1 ${name}_content2
238 + '
239
247 - test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
248 - git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid} > ${name}_content5 &&
249 - git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid} > ${name}_content6 &&
250 - test_cmp ${name}_content5 ${name}_content6
251 -'
240 + test_expect_success $PREREQ "Verify ${name}'s sha256 pretty content" '
241 + git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid} >${name}_content3 &&
242 + git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid} >${name}_content4 &&
243 + test_cmp ${name}_content3 ${name}_content4
244 + '
245
253 - test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
254 - git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} > ${name}_content7 &&
255 - git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} > ${name}_content8 &&
256 - test_cmp ${name}_content7 ${name}_content8
257 -'
246 + test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
247 + git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid} >${name}_content5 &&
248 + git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid} >${name}_content6 &&
249 + test_cmp ${name}_content5 ${name}_content6
250 + '
251
252 + test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
253 + git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} >${name}_content7 &&
254 + git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} >${name}_content8 &&
255 + test_cmp ${name}_content7 ${name}_content8
256 + '
257 }
258
259 compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"