git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 2/2] Switch default hash algorithm to short BLAKE2b for testing

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jan 28, 2018, 17:06 UTC
Message-ID
<20180128170639.216397-3-sandals@crustytoothpaste.net>
In-Reply-To
<20180128170639.216397-1-sandals@crustytoothpaste.net>

Set the default hash algorithm to short (160-bit) BLAKE2b so we can identify tests that rely on a given hash algorithm.

This is a test commit and should not be used in production.  Widespread
test breakage occurs when using this commit.
---
 repository.c  | 2 +-
 setup.c       | 2 +-
 t/test-lib.sh | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/repository.c b/repository.c
index f66fcb1342..95c0ff74d6 100644
--- a/repository.c
+++ b/repository.c
@@ -5,7 +5,7 @@
 
 /* The main repository */
 static struct repository the_repo = {
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, &hash_algos[GIT_HASH_SHA1], 0, 0
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, &hash_algos[GIT_HASH_SBLAKE2], 0, 0
 };
 struct repository *the_repository = &the_repo;
 
diff --git a/setup.c b/setup.c
index 8cc34186ce..72eaee9c4e 100644
--- a/setup.c
+++ b/setup.c
@@ -488,7 +488,7 @@ int read_repository_format(struct repository_format *format, const char *path)
 	memset(format, 0, sizeof(*format));
 	format->version = -1;
 	format->is_bare = -1;
-	format->hash_algo = GIT_HASH_SHA1;
+	format->hash_algo = GIT_HASH_SBLAKE2;
 	string_list_init(&format->unknown_extensions, 1);
 	git_config_from_file(check_repo_format, path, format);
 	return format->version;
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9a0a21f49a..cd257040ad 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -183,8 +183,8 @@ _x40="$_x35$_x05"
 # Zero SHA-1
 _z40=0000000000000000000000000000000000000000
 
-EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+EMPTY_TREE=f44422a644bfa5212387098f253a1e89eba94548
+EMPTY_BLOB=a706650a477f63b9b00eba41272bf36ef5a7dfa2
 
 # Line feed
 LF='
Previous: brian m. carlsonNext: brian m. carlson
Message 2 of 9 in “alternate hash test”
  1. 0/2 alternate hash testbrian m. carlson, Jan 28, 2018
  2. 2/2 Switch default hash algorithm to short BLAKE2b for testingbrian m. carlson, Jan 28, 2018
  3. 1/2 Base test implementation for short BLAKE2b supportbrian m. carlson, Jan 28, 2018
  4. SZEDER GáborJan 28, 2018
  5. Ævar Arnfjörð BjarmasonJan 28, 2018
  6. brian m. carlsonJan 28, 2018
  7. Junio C HamanoJan 30, 2018
  8. Stefan BellerJan 31, 2018
  9. brian m. carlsonFeb 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.