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

[PATCH v2 04/16] commit: express tree entry constants in terms of the_hash_algo

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jul 16, 2018, 01:27 UTC
Message-ID
<20180716012808.961328-5-sandals@crustytoothpaste.net>
In-Reply-To
<20180716012808.961328-1-sandals@crustytoothpaste.net>

Specify these constants in terms of the size of the hash algorithm currently in use.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 commit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/commit.c b/commit.c
index 0c3b75aeff..ff05d04570 100644
--- a/commit.c
+++ b/commit.c
@@ -364,8 +364,8 @@ int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long s
 	struct object_id parent;
 	struct commit_list **pptr;
 	struct commit_graft *graft;
-	const int tree_entry_len = GIT_SHA1_HEXSZ + 5;
-	const int parent_entry_len = GIT_SHA1_HEXSZ + 7;
+	const int tree_entry_len = the_hash_algo->hexsz + 5;
+	const int parent_entry_len = the_hash_algo->hexsz + 7;
 
 	if (item->object.parsed)
 		return 0;
Previous: brian m. carlsonNext: brian m. carlson
Message 6 of 20 in “object_id part 14”
  1. 00/16 object_id part 14brian m. carlson, Jul 16, 2018
  2. 01/16 cache: update object ID functions for the_hash_algobrian m. carlson, Jul 16, 2018
  3. 02/16 tree-walk: replace hard-coded constants with the_hash_algobrian m. carlson, Jul 16, 2018
  4. 03/16 hex: switch to using the_hash_algobrian m. carlson, Jul 16, 2018
  5. 05/16 strbuf: allocate space with GIT_MAX_HEXSZbrian m. carlson, Jul 16, 2018
  6. 04/16 commit: express tree entry constants in terms of the_hash_algobrian m. carlson, Jul 16, 2018
  7. 07/16 refs/files-backend: use the_hash_algo for writing refsbrian m. carlson, Jul 16, 2018
  8. 08/16 builtin/update-index: convert to using the_hash_algobrian m. carlson, Jul 16, 2018
  9. 09/16 builtin/update-index: simplify parsing of cacheinfobrian m. carlson, Jul 16, 2018
  10. 06/16 sha1-name: use the_hash_algo when parsing object namesbrian m. carlson, Jul 16, 2018
  11. 10/16 builtin/fmt-merge-msg: make hash independentbrian m. carlson, Jul 16, 2018
  12. 11/16 builtin/merge: switch to use the_hash_algobrian m. carlson, Jul 16, 2018
  13. 12/16 builtin/merge-recursive: make hash independentbrian m. carlson, Jul 16, 2018
  14. 13/16 diff: switch GIT_SHA1_HEXSZ to use the_hash_algobrian m. carlson, Jul 16, 2018
  15. 14/16 log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexszbrian m. carlson, Jul 16, 2018
  16. 15/16 sha1-file: convert constants to uses of the_hash_algobrian m. carlson, Jul 16, 2018
  17. 16/16 pretty: switch hard-coded constants to the_hash_algobrian m. carlson, Jul 16, 2018
  18. Derrick StoleeJul 16, 2018
  19. Taylor BlauJul 16, 2018
  20. Stefan BellerJul 16, 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.