Re: [PATCH v2] show-index: fix uninitialized hash function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-07-15 at 10:23:43, Abhijeet Sonar wrote:
> diff --git a/t/t8101-show-index-hash-function.sh b/t/t8101-show-index-hash-function.sh
> new file mode 100755
> index 0000000000..2e9308f73c
> --- /dev/null
> +++ b/t/t8101-show-index-hash-function.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +test_description='git show-index'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'show-index: should not fail outside a repository' '
> +    git init --object-format=sha1 && (
> +        echo "" | git hash-object -w --stdin | git pack-objects test &&
> +        rm -rf .git &&
> +        cat test-*.idx | git show-index
> +    )
> +'

I don't think this change is going to work.  If you run with
`GIT_TEST_DEFAULT_HASH=sha256`, as I do, you see this error:

  fatal: attempt to reinitialize repository with different hash

That's because the repository is already initialized as SHA-256 when you
do `git init`.

The reason that the `--object-format` option was added was to make this
configuration work outside a repository.  It would probably be better to
require the user to specify that option if we're outside of a repository
rather than just try to guess.  We want to have _fewer_ dependencies on
SHA-1 as the implicit algorithm, not more.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux