]> git.ipfire.org Git - thirdparty/git.git/commit
object-file-convert: stubs for converting from one object format to another
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:05 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:38 +0000 (14:57 -0700)
commit5e9d802a33ef2912a04984d431defe9809c809e1
tree4684b46fd1c9d9045f44f79299d27846654f1fb2
parent43c8a30d150ecede9709c1f2527c8fba92c65f40
object-file-convert: stubs for converting from one object format to another

Two basic functions are provided:
- convert_object_file Takes an object file it's type and hash algorithm
  and converts it into the equivalent object file that would
  have been generated with hash algorithm "to".

  For blob objects there is no conversation to be done and it is an
  error to use this function on them.

  For commit, tree, and tag objects embedded oids are replaced by the
  oids of the objects they refer to with those objects and their
  object ids reencoded in with the hash algorithm "to".  Signatures
  are rearranged so that they remain valid after the object has
  been reencoded.

- repo_oid_to_algop which takes an oid that refers to an object file
  and returns the oid of the equivalent object file generated
  with the target hash algorithm.

The pair of files object-file-convert.c and object-file-convert.h are
introduced to hold as much of this logic as possible to keep this
conversion logic cleanly separated from everything else and in the
hopes that someday the code will be clean enough git can support
compiling out support for sha1 and the various conversion functions.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
object-file-convert.c [new file with mode: 0644]
object-file-convert.h [new file with mode: 0644]