Message ID | 20200710024728.3100527-36-sandals@crustytoothpaste.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | SHA-256, part 3/3 | expand |
Hi Brian, On Fri, Jul 10, 2020 at 02:47:25AM +0000, brian m. carlson wrote: > diff --git a/t/test-lib.sh b/t/test-lib.sh > index 307bb2207e..30ab0428fb 100644 > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -1689,7 +1689,8 @@ test_lazy_prereq CURL ' > # which will not work with other hash algorithms and tests that work but don't > # test anything meaningful (e.g. special values which cause short collisions). > test_lazy_prereq SHA1 ' > - test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 > + test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 && > + ([ -z "$GIT_DEFAULT_HASH" ] || [ "$GIT_DEFAULT_HASH" = "sha1" ]) Tiny nitpick that I noticed in passing, is there any reason why we need a subshell here? If not, I would just switch this to a command group via {}. -Denton > ' > > test_lazy_prereq REBASE_P '
Denton Liu <liu.denton@gmail.com> writes: > Hi Brian, > > On Fri, Jul 10, 2020 at 02:47:25AM +0000, brian m. carlson wrote: >> diff --git a/t/test-lib.sh b/t/test-lib.sh >> index 307bb2207e..30ab0428fb 100644 >> --- a/t/test-lib.sh >> +++ b/t/test-lib.sh >> @@ -1689,7 +1689,8 @@ test_lazy_prereq CURL ' >> # which will not work with other hash algorithms and tests that work but don't >> # test anything meaningful (e.g. special values which cause short collisions). >> test_lazy_prereq SHA1 ' >> - test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 >> + test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 && >> + ([ -z "$GIT_DEFAULT_HASH" ] || [ "$GIT_DEFAULT_HASH" = "sha1" ]) > > Tiny nitpick that I noticed in passing, is there any reason why we need > a subshell here? If not, I would just switch this to a command group via {}. Nicely caught. Also we do not write [] but use 'test'.
diff --git a/t/test-lib.sh b/t/test-lib.sh index 307bb2207e..30ab0428fb 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1689,7 +1689,8 @@ test_lazy_prereq CURL ' # which will not work with other hash algorithms and tests that work but don't # test anything meaningful (e.g. special values which cause short collisions). test_lazy_prereq SHA1 ' - test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 + test $(git hash-object /dev/null) = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 && + ([ -z "$GIT_DEFAULT_HASH" ] || [ "$GIT_DEFAULT_HASH" = "sha1" ]) ' test_lazy_prereq REBASE_P '
Currently, the SHA1 prerequisite depends on the output of git hash-object. However, in order for that to produce sane behavior, we must be in a repository. If we are not, the default will remain SHA-1, and we'll produce wrong results if we're using SHA-256 for the testsuite but the test assertion starts when we're not in a repository. Check the environment variable we use for this purpose, leaving it to default to SHA-1 if none is specified. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- t/test-lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)