* [PATCH] t1016: clean up style
@ 2024-10-20 12:17 Andrew Kreimer
2024-10-20 12:46 ` Kristoffer Haugsbakk
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Kreimer @ 2024-10-20 12:17 UTC (permalink / raw)
To: git; +Cc: Andrew Kreimer, Taylor Blau
Use `test_config`.
Remove whitespace after redirect operator.
Reported-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Andrew Kreimer <algonell@gmail.com>
---
As discussed in:
- https://lore.kernel.org/git/ZxFyKXDCJkRZYYQY@nand.local/
Tested:
- ubuntu-latest, GitHub Actions.
t/t1016-compatObjectFormat.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t1016-compatObjectFormat.sh b/t/t1016-compatObjectFormat.sh
index be3206a16f..0cc62d2a2d 100755
--- a/t/t1016-compatObjectFormat.sh
+++ b/t/t1016-compatObjectFormat.sh
@@ -116,8 +116,8 @@ do
git config core.repositoryformatversion 1 &&
git config extensions.objectformat $hash &&
git config extensions.compatobjectformat $(compat_hash $hash) &&
- git config gpg.program $TEST_DIRECTORY/t1016/gpg &&
- echo "Hellow World!" > hello &&
+ test_config gpg.program $TEST_DIRECTORY/t1016/gpg &&
+ echo "Hellow World!" >hello &&
eval hello_${hash}_oid=$(git hash-object hello) &&
git update-index --add hello &&
git commit -m "Initial commit" &&
--
2.39.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-10-20 12:17 [PATCH] t1016: clean up style Andrew Kreimer
@ 2024-10-20 12:46 ` Kristoffer Haugsbakk
2024-10-21 21:45 ` Taylor Blau
0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2024-10-20 12:46 UTC (permalink / raw)
To: Andrew Kreimer, git; +Cc: Taylor Blau
Hi
On Sun, Oct 20, 2024, at 14:17, Andrew Kreimer wrote:
> Use `test_config`.
>
> Remove whitespace after redirect operator.
>
> Reported-by: Taylor Blau <me@ttaylorr.com>
> Signed-off-by: Andrew Kreimer <algonell@gmail.com>
> ---
> As discussed in:
> - https://lore.kernel.org/git/ZxFyKXDCJkRZYYQY@nand.local/
> […]
> - git config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> - echo "Hellow World!" > hello &&
> + test_config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> + echo "Hellow World!" >hello &&
What Taylor wrote:
> Thanks, both. [Andrew] -- it's fine to do this in the same, or a
> separate patch in the new round. Thanks.
You’ve posted a new, standalone patch. But what Taylor asked for was a
new round on that typo patch where you either squash these changes into
the original patch or have the typo patch plus this one.
At least that’s how I understand it.
This patch by itself doesn’t do much since the file is full of this
style violation. Which I now realize is what you meant when you
asked:[1]
> Do you mean that '> more' and '> another' should be handled similarly?
You were referring to other style violations in the file. But I only
looked at the email so I didn’t catch that.
🔗 1: https://lore.kernel.org/git/ZxKSFBl_pV2r99dY@void.void/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-10-20 12:46 ` Kristoffer Haugsbakk
@ 2024-10-21 21:45 ` Taylor Blau
2024-10-21 21:48 ` Taylor Blau
0 siblings, 1 reply; 9+ messages in thread
From: Taylor Blau @ 2024-10-21 21:45 UTC (permalink / raw)
To: Kristoffer Haugsbakk; +Cc: Andrew Kreimer, git
On Sun, Oct 20, 2024 at 02:46:18PM +0200, Kristoffer Haugsbakk wrote:
> Hi
>
> On Sun, Oct 20, 2024, at 14:17, Andrew Kreimer wrote:
> > Use `test_config`.
> >
> > Remove whitespace after redirect operator.
> >
> > Reported-by: Taylor Blau <me@ttaylorr.com>
> > Signed-off-by: Andrew Kreimer <algonell@gmail.com>
> > ---
> > As discussed in:
> > - https://lore.kernel.org/git/ZxFyKXDCJkRZYYQY@nand.local/
> > […]
> > - git config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> > - echo "Hellow World!" > hello &&
> > + test_config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> > + echo "Hellow World!" >hello &&
>
> What Taylor wrote:
>
> > Thanks, both. [Andrew] -- it's fine to do this in the same, or a
> > separate patch in the new round. Thanks.
>
> You’ve posted a new, standalone patch. But what Taylor asked for was a
> new round on that typo patch where you either squash these changes into
> the original patch or have the typo patch plus this one.
>
> At least that’s how I understand it.
I said originally that either was fine, but then revised my statement
after remembering that the original topic was already in 'next', so any
further changes would have to be done on top.
Thanks,
Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-10-21 21:45 ` Taylor Blau
@ 2024-10-21 21:48 ` Taylor Blau
2024-10-22 10:29 ` Andrew Kreimer
0 siblings, 1 reply; 9+ messages in thread
From: Taylor Blau @ 2024-10-21 21:48 UTC (permalink / raw)
To: Kristoffer Haugsbakk; +Cc: Andrew Kreimer, git
On Mon, Oct 21, 2024 at 05:45:56PM -0400, Taylor Blau wrote:
> On Sun, Oct 20, 2024 at 02:46:18PM +0200, Kristoffer Haugsbakk wrote:
> > Hi
> >
> > On Sun, Oct 20, 2024, at 14:17, Andrew Kreimer wrote:
> > > Use `test_config`.
> > >
> > > Remove whitespace after redirect operator.
> > >
> > > Reported-by: Taylor Blau <me@ttaylorr.com>
> > > Signed-off-by: Andrew Kreimer <algonell@gmail.com>
> > > ---
> > > As discussed in:
> > > - https://lore.kernel.org/git/ZxFyKXDCJkRZYYQY@nand.local/
> > > […]
> > > - git config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> > > - echo "Hellow World!" > hello &&
> > > + test_config gpg.program $TEST_DIRECTORY/t1016/gpg &&
> > > + echo "Hellow World!" >hello &&
> >
> > What Taylor wrote:
> >
> > > Thanks, both. [Andrew] -- it's fine to do this in the same, or a
> > > separate patch in the new round. Thanks.
> >
> > You’ve posted a new, standalone patch. But what Taylor asked for was a
> > new round on that typo patch where you either squash these changes into
> > the original patch or have the typo patch plus this one.
> >
> > At least that’s how I understand it.
>
> I said originally that either was fine, but then revised my statement
> after remembering that the original topic was already in 'next', so any
> further changes would have to be done on top.
...but after queueing, this patch does not apply cleanly on ak/typofix,
which is what this patch should be based on AFAICT.
Andrew, would you please send a version based on the aforementioned
topic?
Thanks,
Taylor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-10-21 21:48 ` Taylor Blau
@ 2024-10-22 10:29 ` Andrew Kreimer
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Kreimer @ 2024-10-22 10:29 UTC (permalink / raw)
To: Taylor Blau; +Cc: Kristoffer Haugsbakk, git
On Mon, Oct 21, 2024 at 05:48:05PM -0400, Taylor Blau wrote:
> ...but after queueing, this patch does not apply cleanly on ak/typofix,
> which is what this patch should be based on AFAICT.
>
> Andrew, would you please send a version based on the aforementioned
> topic?
>
> Thanks,
> Taylor
Absolutely, thank you both for the clarification.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] t1016: clean up style
@ 2024-11-02 16:53 Andrew Kreimer
2024-11-02 19:11 ` Kristoffer Haugsbakk
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Kreimer @ 2024-11-02 16:53 UTC (permalink / raw)
To: git; +Cc: Andrew Kreimer
Remove whitespace after redirect operator.
Align mixed space/tab usages.
Signed-off-by: Andrew Kreimer <algonell@gmail.com>
---
t/t1016-compatObjectFormat.sh | 261 +++++++++++++++++-----------------
1 file changed, 130 insertions(+), 131 deletions(-)
diff --git a/t/t1016-compatObjectFormat.sh b/t/t1016-compatObjectFormat.sh
index 8341a2fe83..06449937a3 100755
--- a/t/t1016-compatObjectFormat.sh
+++ b/t/t1016-compatObjectFormat.sh
@@ -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"
--
2.47.0.170.g23d289d273.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-11-02 16:53 Andrew Kreimer
@ 2024-11-02 19:11 ` Kristoffer Haugsbakk
2024-11-03 2:42 ` Junio C Hamano
0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2024-11-02 19:11 UTC (permalink / raw)
To: Andrew Kreimer, git
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.
On Sat, Nov 2, 2024, at 17:53, Andrew Kreimer wrote:
> Remove whitespace after redirect operator.
>
> Align mixed space/tab usages.
>
> Signed-off-by: Andrew Kreimer <algonell@gmail.com>
> ---
> t/t1016-compatObjectFormat.sh | 261 +++++++++++++++++-----------------
> 1 file changed, 130 insertions(+), 131 deletions(-)
>
> diff --git a/t/t1016-compatObjectFormat.sh b/t/t1016-compatObjectFormat.sh
> index 8341a2fe83..06449937a3 100755
> --- a/t/t1016-compatObjectFormat.sh
> +++ b/t/t1016-compatObjectFormat.sh
> @@ -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
> + '
Everything up to here looks like whitespace changes. Indeed.
>
> + 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
> + '
> }
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.
>
> compare_oids 'blob' hello "$hello_sha1_oid" "$hello_sha256_oid"
> --
> 2.47.0.170.g23d289d273.dirty
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-11-02 19:11 ` Kristoffer Haugsbakk
@ 2024-11-03 2:42 ` Junio C Hamano
2024-11-03 13:49 ` Andrew Kreimer
0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2024-11-03 2:42 UTC (permalink / raw)
To: Kristoffer Haugsbakk; +Cc: Andrew Kreimer, git
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
> 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.
Thanks for an easy-to-follow-concise-and-to-the-point review
summary. Very much appreciated.
>
> On Sat, Nov 2, 2024, at 17:53, Andrew Kreimer wrote:
>> Remove whitespace after redirect operator.
>>
>> Align mixed space/tab usages.
>>
>> Signed-off-by: Andrew Kreimer <algonell@gmail.com>
>> ...
>> + test_cmp ${name}_content5 ${name}_content6
>> + '
>
> Everything up to here looks like whitespace changes. Indeed.
>> + 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
>> + '
>> }
>
> 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?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] t1016: clean up style
2024-11-03 2:42 ` Junio C Hamano
@ 2024-11-03 13:49 ` Andrew Kreimer
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Kreimer @ 2024-11-03 13:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Kristoffer Haugsbakk, git
On Sat, Nov 02, 2024 at 07:42:35PM -0700, Junio C Hamano wrote:
> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-11-03 13:49 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-20 12:17 [PATCH] t1016: clean up style Andrew Kreimer
2024-10-20 12:46 ` Kristoffer Haugsbakk
2024-10-21 21:45 ` Taylor Blau
2024-10-21 21:48 ` Taylor Blau
2024-10-22 10:29 ` Andrew Kreimer
-- strict thread matches above, loose matches on Subject: below --
2024-11-02 16:53 Andrew Kreimer
2024-11-02 19:11 ` Kristoffer Haugsbakk
2024-11-03 2:42 ` Junio C Hamano
2024-11-03 13:49 ` Andrew Kreimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).