When we're splicing trees, we're writing directly from one location into
a buffer that is exactly the same size as a tree object. If the current
hash algorithm is SHA-1, we may not have a full 32 (GIT_MAX_RAWSZ) bytes
available to write, nor would we want to write that many bytes even if
we did. In a future commit, we'll split out hashcpy to respect
the_hash_algo while oidcpy uses GIT_MAX_RAWSZ, so convert the oidcpy to
a hashcpy so we copy the right number of bytes.

Signed-off-by: brian m. carlson <sand...@crustytoothpaste.net>
---
 match-trees.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/match-trees.c b/match-trees.c
index feca48a5fd..b1fbd022d1 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -224,7 +224,7 @@ static int splice_tree(const struct object_id *oid1, const 
char *prefix,
        } else {
                rewrite_with = oid2;
        }
-       oidcpy(rewrite_here, rewrite_with);
+       hashcpy(rewrite_here->hash, rewrite_with->hash);
        status = write_object_file(buf, sz, tree_type, result);
        free(buf);
        return status;

Reply via email to