Skip to contentSkip to conversation

t1016: clean up style

PATCH In review Andrew Kreimer 3 participants 8 messages Nov 2, 2024 – Nov 4, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t1016: clean up style

Remove whitespace after redirect operator.

Align mixed space/tab usages.

---
 t/t1016-compatObjectFormat.sh | 261 +++++++++++++++++-----------------
 1 file changed, 130 insertions(+), 131 deletions(-)
t/t1016-compatObjectFormat.sh +130 -131
index 8341a2fe83..06449937a3 100755
@@ -24,84 +24,84 @@ TEST_PASSES_SANITIZE_LEAK=true
 # the commit is identical to the commit in the other repository.
 
 compat_hash () {
-    case "$1" in
-    "sha1")
-	echo "sha256"
-	;;
-    "sha256")
-	echo "sha1"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "sha256"
+		;;
+	"sha256")
+		echo "sha1"
+		;;
+	esac
 }
 
 hello_oid () {
-    case "$1" in
-    "sha1")
-	echo "$hello_sha1_oid"
-	;;
-    "sha256")
-	echo "$hello_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$hello_sha1_oid"
+		;;
+	"sha256")
+		echo "$hello_sha256_oid"
+		;;
+	esac
 }
 
 tree_oid () {
-    case "$1" in
-    "sha1")
-	echo "$tree_sha1_oid"
-	;;
-    "sha256")
-	echo "$tree_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$tree_sha1_oid"
+		;;
+	"sha256")
+		echo "$tree_sha256_oid"
+		;;
+	esac
 }
 
 commit_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit_sha256_oid"
+		;;
+	esac
 }
 
 commit2_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit2_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit2_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit2_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit2_sha256_oid"
+		;;
+	esac
 }
 
 del_sigcommit () {
-    local delete="$1"
-
-    if test "$delete" = "sha256" ; then
-	local pattern="gpgsig-sha256"
-    else
-	local pattern="gpgsig"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local delete="$1"
+
+	if test "$delete" = "sha256" ; then
+		local pattern="gpgsig-sha256"
+	else
+		local pattern="gpgsig"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 
 del_sigtag () {
-    local storage="$1"
-    local delete="$2"
-
-    if test "$storage" = "$delete" ; then
-	local pattern="trailer"
-    elif test "$storage" = "sha256" ; then
-	local pattern="gpgsig"
-    else
-	local pattern="gpgsig-sha256"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local storage="$1"
+	local delete="$2"
+
+	if test "$storage" = "$delete" ; then
+		local pattern="trailer"
+	elif test "$storage" = "sha256" ; then
+		local pattern="gpgsig"
+	else
+		local pattern="gpgsig-sha256"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 base=$(pwd)
@@ -146,9 +146,9 @@ do
 	'
 	test_expect_success "create a $hash branch" '
 		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) &&
-		echo "Another and another and another" > another &&
+		echo "Another and another and another" >another &&
 		eval another_${hash}_oid=$(git hash-object another) &&
 		git update-index --add more another &&
 		git commit -m "Add more files!" &&
@@ -165,15 +165,15 @@ do
 	'
 	test_expect_success GPG2 "create additional $hash signed commits" '
 		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 sha1 > "../${hash}_signedcommit4" &&
+		git cat-file commit HEAD | del_sigcommit sha256 >"../${hash}_signedcommit3" &&
+		git cat-file commit HEAD | del_sigcommit sha1 >"../${hash}_signedcommit4" &&
 		eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
 		eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
 	'
 	test_expect_success GPG2 "create additional $hash signed tags" '
 		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}" sha1 > ../${hash}_signedtag4 &&
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >../${hash}_signedtag3 &&
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >../${hash}_signedtag4 &&
 		eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
 		eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
 	'
@@ -181,81 +181,80 @@ done
 cd "$base"
 
 compare_oids () {
-    test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
-    local type="$1"
-    local name="$2"
-    local sha1_oid="$3"
-    local sha256_oid="$4"
-
-    echo ${sha1_oid} > ${name}_sha1_expected
-    echo ${sha256_oid} > ${name}_sha256_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-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
-    local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
-    local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
-
-    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 &&
-	test_cmp ${name}_sha1 ${name}_sha1_expected
-'
-
-    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 &&
-	test_cmp ${name}_sha256 ${name}_sha256_expected
-'
+	test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
+	local type="$1"
+	local name="$2"
+	local sha1_oid="$3"
+	local sha256_oid="$4"
+
+	echo ${sha1_oid} >${name}_sha1_expected
+	echo ${sha256_oid} >${name}_sha256_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-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha256_sha1_found
+	local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
+	local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
+
+	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 &&
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'
 
-    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-sha256/.git cat-file -t ${sha256_sha1_oid} > ${name}_type2 &&
-	test_cmp ${name}_type1 ${name}_type2 &&
-	test_cmp ${name}_type1 ${name}_type_expected
-'
+	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 &&
+		test_cmp ${name}_sha256 ${name}_sha256_expected
+	'
 
-    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-sha1/.git cat-file -t ${sha1_sha256_oid} > ${name}_type4 &&
-	test_cmp ${name}_type3 ${name}_type4 &&
-	test_cmp ${name}_type3 ${name}_type_expected
-'
+	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-sha256/.git cat-file -t ${sha256_sha1_oid} >${name}_type2 &&
+		test_cmp ${name}_type1 ${name}_type2 &&
+		test_cmp ${name}_type1 ${name}_type_expected
+	'
 
-    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-sha256/.git cat-file -s ${sha256_sha1_oid} > ${name}_size2 &&
-	test_cmp ${name}_size1 ${name}_size2
-'
+	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-sha1/.git cat-file -t ${sha1_sha256_oid} >${name}_type4 &&
+		test_cmp ${name}_type3 ${name}_type4 &&
+		test_cmp ${name}_type3 ${name}_type_expected
+	'
 
-    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-sha1/.git cat-file -s ${sha1_sha256_oid} > ${name}_size4 &&
-	test_cmp ${name}_size3 ${name}_size4
-'
+	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-sha256/.git cat-file -s ${sha256_sha1_oid} >${name}_size2 &&
+		test_cmp ${name}_size1 ${name}_size2
+	'
 
-    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-sha256/.git cat-file -p ${sha256_sha1_oid} > ${name}_content2 &&
-	test_cmp ${name}_content1 ${name}_content2
-'
+	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-sha1/.git cat-file -s ${sha1_sha256_oid} >${name}_size4 &&
+		test_cmp ${name}_size3 ${name}_size4
+	'
 
-    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-sha1/.git cat-file -p ${sha1_sha256_oid} > ${name}_content4 &&
-	test_cmp ${name}_content3 ${name}_content4
-'
+	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-sha256/.git cat-file -p ${sha256_sha1_oid} >${name}_content2 &&
+		test_cmp ${name}_content1 ${name}_content2
+	'
 
-    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-sha256/.git cat-file ${type} ${sha256_sha1_oid} > ${name}_content6 &&
-	test_cmp ${name}_content5 ${name}_content6
-'
+	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-sha1/.git cat-file -p ${sha1_sha256_oid} >${name}_content4 &&
+		test_cmp ${name}_content3 ${name}_content4
+	'
 
-    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 sha1 content" '
+		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 &&
+		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
+	'
 }
 
 compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"
Signature · 1 line
2.47.0.170.g23d289d273.dirty
#1 lore raw

Hi

This looks correct according to CodingGuidelines, part “For shell scripts”.

• Whitespace and redirect operator
• Case arms indentation
• Tabs for indentation. It might look like some of the lines in the preimage (term?) use two nesting levels set to four columns, but that is because the first line is indented by four spaces and the next line is indented with one tab (eight columns). The postimage changes them to use one tab per level.

Quoted 378 lines · Andrew Kreimer

Remove whitespace after redirect operator.

Align mixed space/tab usages.

---
 t/t1016-compatObjectFormat.sh | 261 +++++++++++++++++-----------------
 1 file changed, 130 insertions(+), 131 deletions(-)
t/t1016-compatObjectFormat.sh +61 -61
index 8341a2fe83..06449937a3 100755
@@ -24,84 +24,84 @@ TEST_PASSES_SANITIZE_LEAK=true
 # the commit is identical to the commit in the other repository.
 
 compat_hash () {
-    case "$1" in
-    "sha1")
-	echo "sha256"
-	;;
-    "sha256")
-	echo "sha1"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "sha256"
+		;;
+	"sha256")
+		echo "sha1"
+		;;
+	esac
 }
 
 hello_oid () {
-    case "$1" in
-    "sha1")
-	echo "$hello_sha1_oid"
-	;;
-    "sha256")
-	echo "$hello_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$hello_sha1_oid"
+		;;
+	"sha256")
+		echo "$hello_sha256_oid"
+		;;
+	esac
 }
 
 tree_oid () {
-    case "$1" in
-    "sha1")
-	echo "$tree_sha1_oid"
-	;;
-    "sha256")
-	echo "$tree_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$tree_sha1_oid"
+		;;
+	"sha256")
+		echo "$tree_sha256_oid"
+		;;
+	esac
 }
 
 commit_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit_sha256_oid"
+		;;
+	esac
 }
 
 commit2_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit2_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit2_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit2_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit2_sha256_oid"
+		;;
+	esac
 }
 
 del_sigcommit () {
-    local delete="$1"
-
-    if test "$delete" = "sha256" ; then
-	local pattern="gpgsig-sha256"
-    else
-	local pattern="gpgsig"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local delete="$1"
+
+	if test "$delete" = "sha256" ; then
+		local pattern="gpgsig-sha256"
+	else
+		local pattern="gpgsig"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 
 del_sigtag () {
-    local storage="$1"
-    local delete="$2"
-
-    if test "$storage" = "$delete" ; then
-	local pattern="trailer"
-    elif test "$storage" = "sha256" ; then
-	local pattern="gpgsig"
-    else
-	local pattern="gpgsig-sha256"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local storage="$1"
+	local delete="$2"
+
+	if test "$storage" = "$delete" ; then
+		local pattern="trailer"
+	elif test "$storage" = "sha256" ; then
+		local pattern="gpgsig"
+	else
+		local pattern="gpgsig-sha256"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 base=$(pwd)
@@ -146,9 +146,9 @@ do
 	'
 	test_expect_success "create a $hash branch" '
 		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) &&
-		echo "Another and another and another" > another &&
+		echo "Another and another and another" >another &&
 		eval another_${hash}_oid=$(git hash-object another) &&
 		git update-index --add more another &&
 		git commit -m "Add more files!" &&
@@ -165,15 +165,15 @@ do
 	'
 	test_expect_success GPG2 "create additional $hash signed commits" '
 		git commit --gpg-sign --allow-empty -m "This is an additional signed

commit" &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file commit HEAD | del_sigcommit sha256 >

"../${hash}_signedcommit3" &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file commit HEAD | del_sigcommit sha1 >

"../${hash}_signedcommit4" &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file commit HEAD | del_sigcommit sha256
Quoted 1 line

"../${hash}_signedcommit3" &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file commit HEAD | del_sigcommit sha1
Quoted 1 line

"../${hash}_signedcommit4" &&

eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w
../${hash}_signedcommit3) &&
eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w
../${hash}_signedcommit4)

t/t1016-compatObjectFormat.sh +0 -1
 	'
 	test_expect_success GPG2 "create additional $hash signed tags" '
 		git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
-		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >

../${hash}_signedtag3 &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >

../${hash}_signedtag4 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256
Quoted 1 line

../${hash}_signedtag3 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1
Quoted 1 line

../${hash}_signedtag4 &&

eval signedtag3_${hash}_oid=$(git hash-object -t tag -w
../${hash}_signedtag3) &&
eval signedtag4_${hash}_oid=$(git hash-object -t tag -w
../${hash}_signedtag4)

t/t1016-compatObjectFormat.sh +0 -19
 	'
@@ -181,81 +181,80 @@ done
 cd "$base"
 
 compare_oids () {
-    test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
-    local type="$1"
-    local name="$2"
-    local sha1_oid="$3"
-    local sha256_oid="$4"
-
-    echo ${sha1_oid} > ${name}_sha1_expected
-    echo ${sha256_oid} > ${name}_sha256_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-sha256/.git rev-parse
--output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
-    local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
-    local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
-
-    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 &&

t/t1016-compatObjectFormat.sh +0 -5
-	test_cmp ${name}_sha1 ${name}_sha1_expected
-'
-
-    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 &&

t/t1016-compatObjectFormat.sh +11 -2
-	test_cmp ${name}_sha256 ${name}_sha256_expected
-'
+	test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
+	local type="$1"
+	local name="$2"
+	local sha1_oid="$3"
+	local sha256_oid="$4"
+
+	echo ${sha1_oid} >${name}_sha1_expected
+	echo ${sha256_oid} >${name}_sha256_expected
+	echo ${type} >${name}_type_expected
+
+	git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256

${sha1_oid} >${name}_sha1_sha256_found

t/t1016-compatObjectFormat.sh +1 -0
+	git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1

${sha256_oid} >${name}_sha256_sha1_found

t/t1016-compatObjectFormat.sh +5 -0
+	local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
+	local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
+
+	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 &&

t/t1016-compatObjectFormat.sh +2 -2
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
-	git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} > ${name}_type1

&&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid} >

${name}_type2 &&

t/t1016-compatObjectFormat.sh +2 -3
-	test_cmp ${name}_type1 ${name}_type2 &&
-	test_cmp ${name}_type1 ${name}_type_expected
-'
+	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 &&

t/t1016-compatObjectFormat.sh +2 -2
+		test_cmp ${name}_sha256 ${name}_sha256_expected
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
-	git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid} >

${name}_type3 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid} >

${name}_type4 &&

t/t1016-compatObjectFormat.sh +2 -3
-	test_cmp ${name}_type3 ${name}_type4 &&
-	test_cmp ${name}_type3 ${name}_type_expected
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha1 type" '
+		git --git-dir=repo-sha1/.git cat-file -t ${sha1_oid} >${name}_type1

&&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha256/.git cat-file -t ${sha256_sha1_oid}
Quoted 1 line

${name}_type2 &&

t/t1016-compatObjectFormat.sh +3 -2
+		test_cmp ${name}_type1 ${name}_type2 &&
+		test_cmp ${name}_type1 ${name}_type_expected
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
-	git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} > ${name}_size1

&&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid} >

${name}_size2 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_size1 ${name}_size2
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha256 type" '
+		git --git-dir=repo-sha256/.git cat-file -t ${sha256_oid}
Quoted 1 line

${name}_type3 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha1/.git cat-file -t ${sha1_sha256_oid}
Quoted 1 line

${name}_type4 &&

t/t1016-compatObjectFormat.sh +3 -2
+		test_cmp ${name}_type3 ${name}_type4 &&
+		test_cmp ${name}_type3 ${name}_type_expected
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
-	git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid} >

${name}_size3 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid} >

${name}_size4 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_size3 ${name}_size4
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha1 size" '
+		git --git-dir=repo-sha1/.git cat-file -s ${sha1_oid} >${name}_size1

&&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha256/.git cat-file -s ${sha256_sha1_oid}
Quoted 1 line

${name}_size2 &&

t/t1016-compatObjectFormat.sh +2 -1
+		test_cmp ${name}_size1 ${name}_size2
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content"

'

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid} >

${name}_content1 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid} >

${name}_content2 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_content1 ${name}_content2
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha256 size" '
+		git --git-dir=repo-sha256/.git cat-file -s ${sha256_oid}
Quoted 1 line

${name}_size3 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha1/.git cat-file -s ${sha1_sha256_oid}
Quoted 1 line

${name}_size4 &&

t/t1016-compatObjectFormat.sh +2 -1
+		test_cmp ${name}_size3 ${name}_size4
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha256 pretty

content" '

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid} >

${name}_content3 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid} >

${name}_content4 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_content3 ${name}_content4
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha1 pretty content" '
+		git --git-dir=repo-sha1/.git cat-file -p ${sha1_oid}
Quoted 1 line

${name}_content1 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha256/.git cat-file -p ${sha256_sha1_oid}
Quoted 1 line

${name}_content2 &&

t/t1016-compatObjectFormat.sh +2 -2
+		test_cmp ${name}_content1 ${name}_content2
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
-	git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid} >

${name}_content5 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid} >

${name}_content6 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_content5 ${name}_content6
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha256 pretty content" '
+		git --git-dir=repo-sha256/.git cat-file -p ${sha256_oid}
Quoted 1 line

${name}_content3 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha1/.git cat-file -p ${sha1_sha256_oid}
Quoted 1 line

${name}_content4 &&

t/t1016-compatObjectFormat.sh +2 -2
+		test_cmp ${name}_content3 ${name}_content4
+	'
 
-    test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
-	git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid} >

${name}_content7 &&

t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid} >

${name}_content8 &&

t/t1016-compatObjectFormat.sh +2 -2
-	test_cmp ${name}_content7 ${name}_content8
-'
+	test_expect_success $PREREQ "Verify ${name}'s sha1 content" '
+		git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_oid}
Quoted 1 line

${name}_content5 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_sha1_oid}
Quoted 1 line

${name}_content6 &&

t/t1016-compatObjectFormat.sh

Quoted 2 lines
t/t1016-compatObjectFormat.sh +2 -0
+		test_cmp ${name}_content5 ${name}_content6
+	'

Everything up to here looks like whitespace changes. Indeed.

t/t1016-compatObjectFormat.sh done · line 258

Quoted 9 lines
t/t1016-compatObjectFormat.sh +2 -0
+	test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
+		git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid}
Quoted 1 line

${name}_content7 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid}
Quoted 1 line

${name}_content8 &&

t/t1016-compatObjectFormat.sh +2 -0
+		test_cmp ${name}_content7 ${name}_content8
+	'
 }

But this is diffed as an addition. Seems like either a mistake or the commit message and/or patch comment (---) didn’t mention this kind of change.

Quoted 4 lines

compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"
--
2.47.0.170.g23d289d273.dirty

#2 lore raw
Quoted 5 lines · Kristoffer Haugsbakk

Hi

This looks correct according to CodingGuidelines, part “For shell scripts”.

Quoted 7 lines

• Whitespace and redirect operator
• Case arms indentation
• Tabs for indentation. It might look like some of the lines in the preimage (term?) use two nesting levels set to four columns, but that is because the first line is indented by four spaces and the next line is indented with one tab (eight columns). The postimage changes them to use one tab per level.

Thanks for an easy-to-follow-concise-and-to-the-point review summary. Very much appreciated.

Quoted 19 lines · Andrew Kreimer

Review

Quoted 8 lines

Remove whitespace after redirect operator.

Align mixed space/tab usages.

...

(quoted diff) +2 -0
+		test_cmp ${name}_content5 ${name}_content6
+	'

Everything up to here looks like whitespace changes. Indeed.

Quoted 4 lines
(quoted diff) +2 -0
+	test_expect_success $PREREQ "Verify ${name}'s sha256 content" '
+		git --git-dir=repo-sha256/.git cat-file ${type} ${sha256_oid}
Quoted 1 line

${name}_content7 &&

(quoted diff) +1 -0
+		git --git-dir=repo-sha1/.git cat-file ${type} ${sha1_sha256_oid}
Quoted 8 lines

t/t1016-compatObjectFormat.sh done · line 258

Quoted 4 lines
Quoted 1 line

${name}_content8 &&

t/t1016-compatObjectFormat.sh +2 -0
+		test_cmp ${name}_content7 ${name}_content8
+	'
 }

But this is diffed as an addition. Seems like either a mistake or the commit message and/or patch comment (---) didn’t mention this kind of change.

Good eyes. I suspect that it is from a separate topic, and this patch is supposed to be preliminary clean-up for this change, or something?

#3 lore raw
Quoted 3 lines · Junio C Hamano

Good eyes. I suspect that it is from a separate topic, and this patch is supposed to be preliminary clean-up for this change, or something?

I did all of the clean ups again from scratch, the resulting patch files are almost the same.

By eyeballig the instaweb, it seems that the chunks are interleaved far apart, and not side by side as usual.

Will send v2 anyway with improved message body and an extra line to be removed, thank you both.

#4 lore raw

PATCH v2 1/1 t1016: clean up style

In reply to Andrew Kreimer

Adhere to Documentation/CodingGuidelines:
- Whitespace and redirect operator.
- Case arms indentation.
- Tabs for indentation.

---
v2:
- Base on: "The seventh batch".
- Remove the extra line in between functions.
- Elaborate on the changes (thank you, Kristoffer).

 t/t1016-compatObjectFormat.sh | 262 +++++++++++++++++-----------------
 1 file changed, 130 insertions(+), 132 deletions(-)
t/t1016-compatObjectFormat.sh +130 -132
index 8341a2fe83..32e0af392e 100755
@@ -24,84 +24,83 @@ TEST_PASSES_SANITIZE_LEAK=true
 # the commit is identical to the commit in the other repository.
 
 compat_hash () {
-    case "$1" in
-    "sha1")
-	echo "sha256"
-	;;
-    "sha256")
-	echo "sha1"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "sha256"
+		;;
+	"sha256")
+		echo "sha1"
+		;;
+	esac
 }
 
 hello_oid () {
-    case "$1" in
-    "sha1")
-	echo "$hello_sha1_oid"
-	;;
-    "sha256")
-	echo "$hello_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$hello_sha1_oid"
+		;;
+	"sha256")
+		echo "$hello_sha256_oid"
+		;;
+	esac
 }
 
 tree_oid () {
-    case "$1" in
-    "sha1")
-	echo "$tree_sha1_oid"
-	;;
-    "sha256")
-	echo "$tree_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$tree_sha1_oid"
+		;;
+	"sha256")
+		echo "$tree_sha256_oid"
+		;;
+	esac
 }
 
 commit_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit_sha256_oid"
+		;;
+	esac
 }
 
 commit2_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit2_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit2_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit2_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit2_sha256_oid"
+		;;
+	esac
 }
 
 del_sigcommit () {
-    local delete="$1"
-
-    if test "$delete" = "sha256" ; then
-	local pattern="gpgsig-sha256"
-    else
-	local pattern="gpgsig"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local delete="$1"
+
+	if test "$delete" = "sha256" ; then
+		local pattern="gpgsig-sha256"
+	else
+		local pattern="gpgsig"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
-
 del_sigtag () {
-    local storage="$1"
-    local delete="$2"
-
-    if test "$storage" = "$delete" ; then
-	local pattern="trailer"
-    elif test "$storage" = "sha256" ; then
-	local pattern="gpgsig"
-    else
-	local pattern="gpgsig-sha256"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local storage="$1"
+	local delete="$2"
+
+	if test "$storage" = "$delete" ; then
+		local pattern="trailer"
+	elif test "$storage" = "sha256" ; then
+		local pattern="gpgsig"
+	else
+		local pattern="gpgsig-sha256"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 base=$(pwd)
@@ -146,9 +145,9 @@ do
 	'
 	test_expect_success "create a $hash branch" '
 		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) &&
-		echo "Another and another and another" > another &&
+		echo "Another and another and another" >another &&
 		eval another_${hash}_oid=$(git hash-object another) &&
 		git update-index --add more another &&
 		git commit -m "Add more files!" &&
@@ -165,15 +164,15 @@ do
 	'
 	test_expect_success GPG2 "create additional $hash signed commits" '
 		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 sha1 > "../${hash}_signedcommit4" &&
+		git cat-file commit HEAD | del_sigcommit sha256 >"../${hash}_signedcommit3" &&
+		git cat-file commit HEAD | del_sigcommit sha1 >"../${hash}_signedcommit4" &&
 		eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit3) &&
 		eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w ../${hash}_signedcommit4)
 	'
 	test_expect_success GPG2 "create additional $hash signed tags" '
 		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}" sha1 > ../${hash}_signedtag4 &&
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >../${hash}_signedtag3 &&
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >../${hash}_signedtag4 &&
 		eval signedtag3_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag3) &&
 		eval signedtag4_${hash}_oid=$(git hash-object -t tag -w ../${hash}_signedtag4)
 	'
@@ -181,81 +180,80 @@ done
 cd "$base"
 
 compare_oids () {
-    test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
-    local type="$1"
-    local name="$2"
-    local sha1_oid="$3"
-    local sha256_oid="$4"
-
-    echo ${sha1_oid} > ${name}_sha1_expected
-    echo ${sha256_oid} > ${name}_sha256_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-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
-    local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
-    local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
-
-    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 &&
-	test_cmp ${name}_sha1 ${name}_sha1_expected
-'
-
-    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 &&
-	test_cmp ${name}_sha256 ${name}_sha256_expected
-'
+	test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
+	local type="$1"
+	local name="$2"
+	local sha1_oid="$3"
+	local sha256_oid="$4"
+
+	echo ${sha1_oid} >${name}_sha1_expected
+	echo ${sha256_oid} >${name}_sha256_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-sha256/.git rev-parse --output-object-format=sha1 ${sha256_oid} >${name}_sha256_sha1_found
+	local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
+	local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
+
+	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 &&
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'
 
-    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-sha256/.git cat-file -t ${sha256_sha1_oid} > ${name}_type2 &&
-	test_cmp ${name}_type1 ${name}_type2 &&
-	test_cmp ${name}_type1 ${name}_type_expected
-'
+	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 &&
+		test_cmp ${name}_sha256 ${name}_sha256_expected
+	'
 
-    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-sha1/.git cat-file -t ${sha1_sha256_oid} > ${name}_type4 &&
-	test_cmp ${name}_type3 ${name}_type4 &&
-	test_cmp ${name}_type3 ${name}_type_expected
-'
+	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-sha256/.git cat-file -t ${sha256_sha1_oid} >${name}_type2 &&
+		test_cmp ${name}_type1 ${name}_type2 &&
+		test_cmp ${name}_type1 ${name}_type_expected
+	'
 
-    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-sha256/.git cat-file -s ${sha256_sha1_oid} > ${name}_size2 &&
-	test_cmp ${name}_size1 ${name}_size2
-'
+	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-sha1/.git cat-file -t ${sha1_sha256_oid} >${name}_type4 &&
+		test_cmp ${name}_type3 ${name}_type4 &&
+		test_cmp ${name}_type3 ${name}_type_expected
+	'
 
-    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-sha1/.git cat-file -s ${sha1_sha256_oid} > ${name}_size4 &&
-	test_cmp ${name}_size3 ${name}_size4
-'
+	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-sha256/.git cat-file -s ${sha256_sha1_oid} >${name}_size2 &&
+		test_cmp ${name}_size1 ${name}_size2
+	'
 
-    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-sha256/.git cat-file -p ${sha256_sha1_oid} > ${name}_content2 &&
-	test_cmp ${name}_content1 ${name}_content2
-'
+	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-sha1/.git cat-file -s ${sha1_sha256_oid} >${name}_size4 &&
+		test_cmp ${name}_size3 ${name}_size4
+	'
 
-    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-sha1/.git cat-file -p ${sha1_sha256_oid} > ${name}_content4 &&
-	test_cmp ${name}_content3 ${name}_content4
-'
+	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-sha256/.git cat-file -p ${sha256_sha1_oid} >${name}_content2 &&
+		test_cmp ${name}_content1 ${name}_content2
+	'
 
-    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-sha256/.git cat-file ${type} ${sha256_sha1_oid} > ${name}_content6 &&
-	test_cmp ${name}_content5 ${name}_content6
-'
+	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-sha1/.git cat-file -p ${sha1_sha256_oid} >${name}_content4 &&
+		test_cmp ${name}_content3 ${name}_content4
+	'
 
-    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 sha1 content" '
+		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 &&
+		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
+	'
 }
 
 compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"

Interdiff against v1:
diff --git a/t/t1016-compatObjectFormat.sh b/t/t1016-compatObjectFormat.sh index 06449937a3..32e0af392e 100755
--- a/t/t1016-compatObjectFormat.sh
+++ b/t/t1016-compatObjectFormat.sh
@@ -89,7 +89,6 @@ del_sigcommit () {
test-tool delete-gpgsig "$pattern"
}

  -
   del_sigtag () {
   	local storage="$1"
   	local delete="$2"

Range-diff against v1:
1: d83cddf1d3 ! 1: e5a1dc0b77 t1016: clean up style
@@ Metadata
## Commit message ##
t1016: clean up style

- Remove whitespace after redirect operator.
-
- Align mixed space/tab usages.
+ Adhere to Documentation/CodingGuidelines:
+ - Whitespace and redirect operator.
+ - Case arms indentation.
+ - Tabs for indentation.

@@ t/t1016-compatObjectFormat.sh: TEST_PASSES_SANITIZE_LEAK=true
+ test-tool delete-gpgsig "$pattern"
}

-
+-
del_sigtag () {
- local storage="$1"
- local delete="$2"

Signature · 1 line
2.47.0.229.g8f8d6eee53
#5 lore raw

I can confirm that everything looks correct now. Like in my reply to v1.

https://lore.kernel.org/git/[email protected]/T/#m0d6626e6495b978b7116bf1561effe10f6792d24

Quoted 209 lines · Andrew Kreimer

Adhere to Documentation/CodingGuidelines:
- Whitespace and redirect operator.
- Case arms indentation.
- Tabs for indentation.

---
v2:
- Base on: "The seventh batch".
- Remove the extra line in between functions.
- Elaborate on the changes (thank you, Kristoffer).

 t/t1016-compatObjectFormat.sh | 262 +++++++++++++++++-----------------
 1 file changed, 130 insertions(+), 132 deletions(-)
t/t1016-compatObjectFormat.sh +61 -62
index 8341a2fe83..32e0af392e 100755
@@ -24,84 +24,83 @@ TEST_PASSES_SANITIZE_LEAK=true
 # the commit is identical to the commit in the other repository.
 
 compat_hash () {
-    case "$1" in
-    "sha1")
-	echo "sha256"
-	;;
-    "sha256")
-	echo "sha1"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "sha256"
+		;;
+	"sha256")
+		echo "sha1"
+		;;
+	esac
 }
 
 hello_oid () {
-    case "$1" in
-    "sha1")
-	echo "$hello_sha1_oid"
-	;;
-    "sha256")
-	echo "$hello_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$hello_sha1_oid"
+		;;
+	"sha256")
+		echo "$hello_sha256_oid"
+		;;
+	esac
 }
 
 tree_oid () {
-    case "$1" in
-    "sha1")
-	echo "$tree_sha1_oid"
-	;;
-    "sha256")
-	echo "$tree_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$tree_sha1_oid"
+		;;
+	"sha256")
+		echo "$tree_sha256_oid"
+		;;
+	esac
 }
 
 commit_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit_sha256_oid"
+		;;
+	esac
 }
 
 commit2_oid () {
-    case "$1" in
-    "sha1")
-	echo "$commit2_sha1_oid"
-	;;
-    "sha256")
-	echo "$commit2_sha256_oid"
-	;;
-    esac
+	case "$1" in
+	"sha1")
+		echo "$commit2_sha1_oid"
+		;;
+	"sha256")
+		echo "$commit2_sha256_oid"
+		;;
+	esac
 }
 
 del_sigcommit () {
-    local delete="$1"
-
-    if test "$delete" = "sha256" ; then
-	local pattern="gpgsig-sha256"
-    else
-	local pattern="gpgsig"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local delete="$1"
+
+	if test "$delete" = "sha256" ; then
+		local pattern="gpgsig-sha256"
+	else
+		local pattern="gpgsig"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
-
 del_sigtag () {
-    local storage="$1"
-    local delete="$2"
-
-    if test "$storage" = "$delete" ; then
-	local pattern="trailer"
-    elif test "$storage" = "sha256" ; then
-	local pattern="gpgsig"
-    else
-	local pattern="gpgsig-sha256"
-    fi
-    test-tool delete-gpgsig "$pattern"
+	local storage="$1"
+	local delete="$2"
+
+	if test "$storage" = "$delete" ; then
+		local pattern="trailer"
+	elif test "$storage" = "sha256" ; then
+		local pattern="gpgsig"
+	else
+		local pattern="gpgsig-sha256"
+	fi
+	test-tool delete-gpgsig "$pattern"
 }
 
 base=$(pwd)
@@ -146,9 +145,9 @@ do
 	'
 	test_expect_success "create a $hash branch" '
 		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) &&
-		echo "Another and another and another" > another &&
+		echo "Another and another and another" >another &&
 		eval another_${hash}_oid=$(git hash-object another) &&
 		git update-index --add more another &&
 		git commit -m "Add more files!" &&
@@ -165,15 +164,15 @@ do
 	'
 	test_expect_success GPG2 "create additional $hash signed commits" '
 		git commit --gpg-sign --allow-empty -m "This is an additional signed

commit" &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file commit HEAD | del_sigcommit sha256 >

"../${hash}_signedcommit3" &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file commit HEAD | del_sigcommit sha1 >

"../${hash}_signedcommit4" &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file commit HEAD | del_sigcommit sha256
Quoted 1 line

"../${hash}_signedcommit3" &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file commit HEAD | del_sigcommit sha1
Quoted 1 line

"../${hash}_signedcommit4" &&

eval signedcommit3_${hash}_oid=$(git hash-object -t commit -w
../${hash}_signedcommit3) &&
eval signedcommit4_${hash}_oid=$(git hash-object -t commit -w
../${hash}_signedcommit4)

t/t1016-compatObjectFormat.sh +0 -1
 	'
 	test_expect_success GPG2 "create additional $hash signed tags" '
 		git tag -s -m "This is an additional signed tag" signedtag34 HEAD &&
-		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256 >

../${hash}_signedtag3 &&

t/t1016-compatObjectFormat.sh +0 -1
-		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1 >

../${hash}_signedtag4 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha256
Quoted 1 line

../${hash}_signedtag3 &&

t/t1016-compatObjectFormat.sh +1 -0
+		git cat-file tag signedtag34 | del_sigtag "${hash}" sha1
Quoted 1 line

../${hash}_signedtag4 &&

eval signedtag3_${hash}_oid=$(git hash-object -t tag -w
../${hash}_signedtag3) &&
eval signedtag4_${hash}_oid=$(git hash-object -t tag -w
../${hash}_signedtag4)

t/t1016-compatObjectFormat.sh +0 -0
 	'

t/t1016-compatObjectFormat.sh done · line 180

Quoted 1 line
t/t1016-compatObjectFormat.sh +0 -0
@@ -181,81 +180,80 @@ done
 cd "$base"

All changes up to here are straightforward.

After this my pager[1] gets confused and --color-words becomes useful.

🔗 1: https://github.com/dandavison/delta

Quoted 22 lines
t/t1016-compatObjectFormat.sh +0 -19
 compare_oids () {
-    test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
-    local type="$1"
-    local name="$2"
-    local sha1_oid="$3"
-    local sha256_oid="$4"
-
-    echo ${sha1_oid} > ${name}_sha1_expected
-    echo ${sha256_oid} > ${name}_sha256_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-sha256/.git rev-parse
--output-object-format=sha1 ${sha256_oid} > ${name}_sha256_sha1_found
-    local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
-    local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
-
-    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 &&

t/t1016-compatObjectFormat.sh done · line 204

Quoted 4 lines
t/t1016-compatObjectFormat.sh +0 -4
-	test_cmp ${name}_sha1 ${name}_sha1_expected
-'
-
-    test_expect_success $PREREQ "Verify ${type} ${name}'s sha256 oid" '

At this point the diff gets weird. There seems to be too many whitespace changes to get a good diff. But that can be handled (see next part).

Quoted 18 lines
t/t1016-compatObjectFormat.sh +0 -1
-	git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256

${sha1_oid} > ${name}_sha256 &&

t/t1016-compatObjectFormat.sh +11 -2
-	test_cmp ${name}_sha256 ${name}_sha256_expected
-'
+	test "$#" = 5 && { local PREREQ="$1"; shift; } || PREREQ=
+	local type="$1"
+	local name="$2"
+	local sha1_oid="$3"
+	local sha256_oid="$4"
+
+	echo ${sha1_oid} >${name}_sha1_expected
+	echo ${sha256_oid} >${name}_sha256_expected
+	echo ${type} >${name}_type_expected
+
+	git --git-dir=repo-sha1/.git rev-parse --output-object-format=sha256

${sha1_oid} >${name}_sha1_sha256_found

t/t1016-compatObjectFormat.sh +1 -0
+	git --git-dir=repo-sha256/.git rev-parse --output-object-format=sha1

${sha256_oid} >${name}_sha256_sha1_found

t/t1016-compatObjectFormat.sh done · line 197

Quoted 3 lines
t/t1016-compatObjectFormat.sh +3 -0
+	local sha1_sha256_oid="$(cat ${name}_sha1_sha256_found)"
+	local sha256_sha1_oid="$(cat ${name}_sha256_sha1_found)"
+

Indeed this looks like only indentation and redirection whitespace fixes.

t/t1016-compatObjectFormat.sh

Quoted 5 lines
t/t1016-compatObjectFormat.sh +2 -0
+	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 &&

t/t1016-compatObjectFormat.sh +2 -0
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'

At this point it _looks like_ some test_expect_success are moved around. But my diff deceives me: all of the eight test_ are provided in the same order in the preimage and postimage.

Here I removed the fixes for the trailing ', i.e. moved them back to the beginning of the line:

```
'
```

And that gave me a nice clean diff which again highlighted the indentation fixes as well as the redirection operator fixes.

Indeed it all looks correct.

Quoted 1 line

[…]

#6 lore raw
Quoted 9 lines · Kristoffer Haugsbakk

Review

Quoted 5 lines
(quoted diff) +2 -0
+	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 &&

(quoted diff) +2 -0
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'

At this point it _looks like_ some test_expect_success are moved around. But my diff deceives me: all of the eight test_ are provided in the same order in the preimage and postimage.

Yes, the output from "git show --histogram" seems to match the corresponding blocks in preimage and postimage better in this case.

Thanks, both.

#7 lore raw
Quoted 12 lines · Junio C Hamano
Quoted 9 lines · Kristoffer Haugsbakk

Review

Quoted 5 lines
(quoted diff) +2 -0
+	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 &&

(quoted diff) +2 -0
+		test_cmp ${name}_sha1 ${name}_sha1_expected
+	'

At this point it _looks like_ some test_expect_success are moved around. But my diff deceives me: all of the eight test_ are provided in the same order in the preimage and postimage.

Quoted 2 lines

Yes, the output from "git show --histogram" seems to match the corresponding blocks in preimage and postimage better in this case.

…I’ve known about histogram but never tried it. It does work well in this case. Noted, thanks. :)