diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2023-10-01 21:40:19 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 14:57:39 -0700 |
commit | 33a14e81ae0673f8b3f7cf85168c7c573fa2fb58 (patch) | |
tree | d27d33812f0842331dc4e9e799301f0e6374ff2a /builtin/commit.c | |
parent | 45b3b1214154975ac03c818838e3d12571f57d1e (diff) |
object-file-convert: add a function to convert trees between algorithms
In the future, we're going to want to provide SHA-256 repositories that
have compatibility support for SHA-1 as well. In order to do so, we'll
need to be able to convert tree objects from SHA-256 to SHA-1 by writing
a tree with each SHA-256 object ID mapped to a SHA-1 object ID.
We implement a function, convert_tree_object, that takes an existing
tree buffer and writes it to a new strbuf, converting between
algorithms. Let's make this function generic, because while we only
need it to convert from the main algorithm to the compatibility
algorithm now, we may need to do the other way around in the future,
such as for transport.
We avoid reusing the code in decode_tree_entry because that code
normalizes data, and we don't want that here. We want to produce a
complete round trip of data, so if, for example, the old entry had a
wrongly zero-padded mode, we'd want to preserve that when converting to
ensure a stable hash value.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions