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>
This commit is contained in:

committed by
Junio C Hamano

parent
8f8d6eee53
commit
a1fb77fcb8
@ -24,84 +24,83 @@ TEST_PASSES_SANITIZE_LEAK=true
|
|||||||
# the commit is identical to the commit in the other repository.
|
# the commit is identical to the commit in the other repository.
|
||||||
|
|
||||||
compat_hash () {
|
compat_hash () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sha1")
|
"sha1")
|
||||||
echo "sha256"
|
echo "sha256"
|
||||||
;;
|
;;
|
||||||
"sha256")
|
"sha256")
|
||||||
echo "sha1"
|
echo "sha1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
hello_oid () {
|
hello_oid () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sha1")
|
"sha1")
|
||||||
echo "$hello_sha1_oid"
|
echo "$hello_sha1_oid"
|
||||||
;;
|
;;
|
||||||
"sha256")
|
"sha256")
|
||||||
echo "$hello_sha256_oid"
|
echo "$hello_sha256_oid"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_oid () {
|
tree_oid () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sha1")
|
"sha1")
|
||||||
echo "$tree_sha1_oid"
|
echo "$tree_sha1_oid"
|
||||||
;;
|
;;
|
||||||
"sha256")
|
"sha256")
|
||||||
echo "$tree_sha256_oid"
|
echo "$tree_sha256_oid"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
commit_oid () {
|
commit_oid () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sha1")
|
"sha1")
|
||||||
echo "$commit_sha1_oid"
|
echo "$commit_sha1_oid"
|
||||||
;;
|
;;
|
||||||
"sha256")
|
"sha256")
|
||||||
echo "$commit_sha256_oid"
|
echo "$commit_sha256_oid"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
commit2_oid () {
|
commit2_oid () {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"sha1")
|
"sha1")
|
||||||
echo "$commit2_sha1_oid"
|
echo "$commit2_sha1_oid"
|
||||||
;;
|
;;
|
||||||
"sha256")
|
"sha256")
|
||||||
echo "$commit2_sha256_oid"
|
echo "$commit2_sha256_oid"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
del_sigcommit () {
|
del_sigcommit () {
|
||||||
local delete="$1"
|
local delete="$1"
|
||||||
|
|
||||||
if test "$delete" = "sha256" ; then
|
if test "$delete" = "sha256" ; then
|
||||||
local pattern="gpgsig-sha256"
|
local pattern="gpgsig-sha256"
|
||||||
else
|
else
|
||||||
local pattern="gpgsig"
|
local pattern="gpgsig"
|
||||||
fi
|
fi
|
||||||
test-tool delete-gpgsig "$pattern"
|
test-tool delete-gpgsig "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
del_sigtag () {
|
del_sigtag () {
|
||||||
local storage="$1"
|
local storage="$1"
|
||||||
local delete="$2"
|
local delete="$2"
|
||||||
|
|
||||||
if test "$storage" = "$delete" ; then
|
if test "$storage" = "$delete" ; then
|
||||||
local pattern="trailer"
|
local pattern="trailer"
|
||||||
elif test "$storage" = "sha256" ; then
|
elif test "$storage" = "sha256" ; then
|
||||||
local pattern="gpgsig"
|
local pattern="gpgsig"
|
||||||
else
|
else
|
||||||
local pattern="gpgsig-sha256"
|
local pattern="gpgsig-sha256"
|
||||||
fi
|
fi
|
||||||
test-tool delete-gpgsig "$pattern"
|
test-tool delete-gpgsig "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
base=$(pwd)
|
base=$(pwd)
|
||||||
@ -146,9 +145,9 @@ do
|
|||||||
'
|
'
|
||||||
test_expect_success "create a $hash branch" '
|
test_expect_success "create a $hash branch" '
|
||||||
git checkout -b branch $(commit_oid $hash) &&
|
git checkout -b branch $(commit_oid $hash) &&
|
||||||
echo "More more more give me more!" > more &&
|
echo "More more more give me more!" >more &&
|
||||||
eval more_${hash}_oid=$(git hash-object more) &&
|
eval more_${hash}_oid=$(git hash-object more) &&
|
||||||
echo "Another and another and another" > another &&
|
echo "Another and another and another" >another &&
|
||||||
eval another_${hash}_oid=$(git hash-object another) &&
|
eval another_${hash}_oid=$(git hash-object another) &&
|
||||||
git update-index --add more another &&
|
git update-index --add more another &&
|
||||||
git commit -m "Add more files!" &&
|
git commit -m "Add more files!" &&
|
||||||
@ -165,15 +164,15 @@ do
|
|||||||
'
|
'
|
||||||
test_expect_success GPG2 "create additional $hash signed commits" '
|
test_expect_success GPG2 "create additional $hash signed commits" '
|
||||||
git commit --gpg-sign --allow-empty -m "This is an additional signed commit" &&
|
git commit --gpg-sign --allow-empty -m "This is an additional signed commit" &&
|
||||||
git cat-file commit HEAD | del_sigcommit sha256 > "../${hash}_signedcommit3" &&
|
git cat-file commit HEAD | del_sigcommit sha256 >"../${hash}_signedcommit3" &&
|
||||||
git cat-file commit HEAD | del_sigcommit sha1 > "../${hash}_signedcommit4" &&
|
git cat-file commit HEAD | del_sigcommit sha1 >"../${hash}_signedcommit4" &&
|
||||||
eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
|
eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
|
||||||
eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
|
eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
|
||||||
'
|
'
|
||||||
test_expect_success GPG2 "create additional $hash signed tags" '
|
test_expect_success GPG2 "create additional $hash signed tags" '
|
||||||
git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
|
git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
|
||||||
git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 > ../${hash}_signedtag3 &&
|
git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >../${hash}_signedtag3 &&
|
||||||
git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 > ../${hash}_signedtag4 &&
|
git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >../${hash}_signedtag4 &&
|
||||||
eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
|
eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
|
||||||
eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
|
eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
|
||||||
'
|
'
|
||||||
@ -181,81 +180,80 @@ done
|
|||||||
cd "$base"
|
cd "$base"
|
||||||
|
|
||||||
compare_oids () {
|
compare_oids () {
|
||||||
test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
|
test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
|
||||||
local type="$1"
|
local type="$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
local sha1_oid="$3"
|
local sha1_oid="$3"
|
||||||
local sha256_oid="$4"
|
local sha256_oid="$4"
|
||||||
|
|
||||||
echo ${sha1_oid} > ${name}_sha1_expected
|
echo ${sha1_oid} >${name}_sha1_expected
|
||||||
echo ${sha256_oid} > ${name}_sha256_expected
|
echo ${sha256_oid} >${name}_sha256_expected
|
||||||
echo ${type} > ${name}_type_expected
|
echo ${type} >${name}_type_expected
|
||||||
|
|
||||||
git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name}_sha1_sha256_found
|
git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} >${name}_sha1_sha256_found
|
||||||
git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
|
git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha256_sha1_found
|
||||||
local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
|
local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
|
||||||
local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
|
local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${type} ${name}'s sha1 oid" '
|
test_expect_success $PREREQ "Verify ${type} ${name}'s sha1 oid" '
|
||||||
git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha1 &&
|
git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha1 &&
|
||||||
test_cmp ${name}_sha1 ${name}_sha1_expected
|
test_cmp ${name}_sha1 ${name}_sha1_expected
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${type} ${name}'s sha256 oid" '
|
test_expect_success $PREREQ "Verify ${type} ${name}'s sha256 oid" '
|
||||||
git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} > ${name}_sha256 &&
|
git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256 ${sha1_oid} >${name}_sha256 &&
|
||||||
test_cmp ${name}_sha256 ${name}_sha256_expected
|
test_cmp ${name}_sha256 ${name}_sha256_expected
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
|
test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
|
||||||
git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} > ${name}_type1 &&
|
git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} >${name}_type1 &&
|
||||||
git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} > ${name}_type2 &&
|
git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} >${name}_type2 &&
|
||||||
test_cmp ${name}_type1 ${name}_type2 &&
|
test_cmp ${name}_type1 ${name}_type2 &&
|
||||||
test_cmp ${name}_type1 ${name}_type_expected
|
test_cmp ${name}_type1 ${name}_type_expected
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
|
test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
|
||||||
git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} > ${name}_type3 &&
|
git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} >${name}_type3 &&
|
||||||
git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} > ${name}_type4 &&
|
git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} >${name}_type4 &&
|
||||||
test_cmp ${name}_type3 ${name}_type4 &&
|
test_cmp ${name}_type3 ${name}_type4 &&
|
||||||
test_cmp ${name}_type3 ${name}_type_expected
|
test_cmp ${name}_type3 ${name}_type_expected
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
|
test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
|
||||||
git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} > ${name}_size1 &&
|
git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} >${name}_size1 &&
|
||||||
git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} > ${name}_size2 &&
|
git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} >${name}_size2 &&
|
||||||
test_cmp ${name}_size1 ${name}_size2
|
test_cmp ${name}_size1 ${name}_size2
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
|
test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
|
||||||
git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid} > ${name}_size3 &&
|
git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid} >${name}_size3 &&
|
||||||
git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid} > ${name}_size4 &&
|
git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid} >${name}_size4 &&
|
||||||
test_cmp ${name}_size3 ${name}_size4
|
test_cmp ${name}_size3 ${name}_size4
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content" '
|
test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content" '
|
||||||
git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid} > ${name}_content1 &&
|
git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid} >${name}_content1 &&
|
||||||
git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid} > ${name}_content2 &&
|
git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid} >${name}_content2 &&
|
||||||
test_cmp ${name}_content1 ${name}_content2
|
test_cmp ${name}_content1 ${name}_content2
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha256 pretty content" '
|
test_expect_success $PREREQ "Verify ${name}'s sha256 pretty content" '
|
||||||
git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid} > ${name}_content3 &&
|
git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid} >${name}_content3 &&
|
||||||
git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid} > ${name}_content4 &&
|
git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid} >${name}_content4 &&
|
||||||
test_cmp ${name}_content3 ${name}_content4
|
test_cmp ${name}_content3 ${name}_content4
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
|
test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
|
||||||
git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid} > ${name}_content5 &&
|
git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid} >${name}_content5 &&
|
||||||
git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid} > ${name}_content6 &&
|
git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid} >${name}_content6 &&
|
||||||
test_cmp ${name}_content5 ${name}_content6
|
test_cmp ${name}_content5 ${name}_content6
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
|
|
||||||
git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} > ${name}_content7 &&
|
|
||||||
git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} > ${name}_content8 &&
|
|
||||||
test_cmp ${name}_content7 ${name}_content8
|
|
||||||
'
|
|
||||||
|
|
||||||
|
test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
|
||||||
|
git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} >${name}_content7 &&
|
||||||
|
git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} >${name}_content8 &&
|
||||||
|
test_cmp ${name}_content7 ${name}_content8
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"
|
compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"
|
||||||
|
Reference in New Issue
Block a user