Adrian Ratiu has been testing SHA-1/SHA-256 interoperability among Git, Gitoxide and Jujutsu. His three-patch series fixes bugs this found in extensions.compatObjectFormat.
One patch makes git rev-parse --output-object-format=<compat-format> stop printing the wrong ID. Git does not record a compat ID for every object, for example objects received through index-pack. For those, rev-parse ignored the return value of repo_oid_to_algop() and silently printed the storage ID with exit code 0. The fix is to die with the same message as pack-objects.
Another patch handles a compatObjectFormat set to the same hash as the repository's own format. In builds with Rust, every command, including git config, aborted with a BUG at repository.c:204, so the bad value could not be removed with Git. The fix adds a check in verify_repository_format() that returns an error instead.
The third patch is the one Ratiu flagged for careful review. Commit creation copies unknown commit headers when converting to the compat format, but converting an existing commit fails on them. As a result, git commit --amend can record a compat ID that cannot be read back. The patch makes both paths copy unknown headers. That removes a check added on purpose in 08a45903cb, and Ratiu says he is not sure it is the right direction.
In v2, changes made after Patrick Steinhardt's review include checking repo_oid_to_algop() for < 0 and matching the "tree", "parent" and "mergetag" headers by key. Ratiu said he would still welcome a look from Eric or brian.