diff mbox series

[20/24] t5703: make test work with SHA-256

Message ID 20200113123857.3684632-21-sandals@crustytoothpaste.net (mailing list archive)
State New, archived
Headers show
Series SHA-256 test fixes, part 8 | expand

Commit Message

brian m. carlson Jan. 13, 2020, 12:38 p.m. UTC
This test used an object ID which was 40 hex characters in length,
causing the test not only not to pass, but to hang, when run with
SHA-256 as the hash.  Change this value to a fixed dummy object ID using
test_oid_init and test_oid.

Furthermore, ensure we extract an object ID of the appropriate length
using cut with fields instead of a fixed length.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 t/t5703-upload-pack-ref-in-want.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Sunshine Jan. 13, 2020, 1:53 p.m. UTC | #1
On Mon, Jan 13, 2020 at 7:41 AM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
> diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
> @@ -19,7 +19,7 @@ get_actual_commits () {
>         git verify-pack -v o.idx >objs &&
> -       grep commit objs | cut -c-40 | sort >actual_commits
> +       grep commit objs | cut -d" " -f1 | sort >actual_commits
>  }
> @@ -37,6 +37,7 @@ check_output () {
>  test_expect_success 'setup repository' '
> +       test_oid_init &&
>         test_commit a &&

I think this `test_oid_init` is supposed to be introduced in patch
21/24, not here in 20/24 for which it serves no purpose.
brian m. carlson Jan. 13, 2020, 11:15 p.m. UTC | #2
On 2020-01-13 at 13:53:12, Eric Sunshine wrote:
> On Mon, Jan 13, 2020 at 7:41 AM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
> > @@ -19,7 +19,7 @@ get_actual_commits () {
> >         git verify-pack -v o.idx >objs &&
> > -       grep commit objs | cut -c-40 | sort >actual_commits
> > +       grep commit objs | cut -d" " -f1 | sort >actual_commits
> >  }
> > @@ -37,6 +37,7 @@ check_output () {
> >  test_expect_success 'setup repository' '
> > +       test_oid_init &&
> >         test_commit a &&
> 
> I think this `test_oid_init` is supposed to be introduced in patch
> 21/24, not here in 20/24 for which it serves no purpose.

You're right.  I'll just squash them together, since they don't really
make sense being separate.
diff mbox series

Patch

diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index 1424fabd4a..852c01ecb4 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -19,7 +19,7 @@  get_actual_commits () {
 		}' <out | test-tool pkt-line unpack-sideband >o.pack &&
 	git index-pack o.pack &&
 	git verify-pack -v o.idx >objs &&
-	grep commit objs | cut -c-40 | sort >actual_commits
+	grep commit objs | cut -d" " -f1 | sort >actual_commits
 }
 
 check_output () {
@@ -37,6 +37,7 @@  check_output () {
 #             \ | /
 #               a
 test_expect_success 'setup repository' '
+	test_oid_init &&
 	test_commit a &&
 	git checkout -b o/foo &&
 	test_commit b &&