Commit 563751d1a63dbfc81a7df676e760b9afe7ff7a17

Edward Thomson 2022-01-22T06:42:50

treecache: write the raw id not the object We explicitly want to write on the id data, not the beginning of the object data, which may contain other information in the future.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/libgit2/tree-cache.c b/src/libgit2/tree-cache.c
index 0977c92..cd69e7b 100644
--- a/src/libgit2/tree-cache.c
+++ b/src/libgit2/tree-cache.c
@@ -263,7 +263,7 @@ static void write_tree(git_str *out, git_tree_cache *tree)
 	git_str_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
 
 	if (tree->entry_count != -1)
-		git_str_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);
+		git_str_put(out, (char *)&tree->oid.id, GIT_OID_RAWSZ);
 
 	for (i = 0; i < tree->children_count; i++)
 		write_tree(out, tree->children[i]);