Thread (58 messages) flat view 58 messages, 2 authors, 2020-07-26

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

From: Eric Sunshine <hidden>
Date: 2020-07-26 23:42:06

On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson
[off-list ref] wrote:
Now that the we have a complete SHA-256 implementation in Git, let's
Reader trips over "Now that the we".
quoted hunk ↗ jump to hunk
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 <redacted>
---
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help