Re: [PATCH v4 33/39] Enable SHA-256 support by default

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

 



On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson
<sandals@xxxxxxxxxxxxxxxxxxxx> wrote:
> Now that the we have a complete SHA-256 implementation in Git, let's

Reader trips over "Now that the we".

> enable it so people can use it.  Remove the ENABLE_SHA256 define
> constant everywhere it's used.  Add tests for initializing a repository
> with SHA-256.
>
> Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
> ---
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> @@ -441,6 +441,35 @@ test_expect_success 're-init from a linked worktree' '
> +test_expect_success 'init honors GIT_DEFAULT_HASH' '
> +       GIT_DEFAULT_HASH=sha1 git init sha1 &&
> +       git -C sha1 rev-parse --show-object-format >actual &&
> +       echo sha1 >expected &&
> +       test_cmp expected actual &&
> +       GIT_DEFAULT_HASH=sha256 git init sha256 &&
> +       git -C sha256 rev-parse --show-object-format >actual &&
> +       echo sha256 >expected &&
> +       test_cmp expected actual
> +'

By testing GIT_DEFAULT_HASH with two different values, this test does
a reasonable job of convincing readers that GIT_DEFAULT_HASH is indeed
respected.

> +test_expect_success 'init honors --object-format' '
> +       git init --object-format=sha256 explicit &&
> +       git -C explicit rev-parse --show-object-format >actual &&
> +       echo sha256 >expected &&
> +       test_cmp expected actual
> +'

However, by testing only --object-format=sha256, neither the reader
nor the test can be sure that the reported object format came from
--object-format= or from the default value used by git-init.



[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