sha256: simplify API changes for sha256 support

There are several places where users may want to specify the type of
object IDs (sha1 or sha256) that should be used, for example, when
dealing with repositories, indexes, etc.

However, given that sha256 support remains disappointingly uncommon in
the wild, we should avoid hard API breaks when possible. Instead, update
these APIs to have an "extended" format (eg, `git_odb_open_ext`) that
provides an options structure with oid type information.

This allows callers who do care about sha256 to use it, and callers who
do not to avoid gratuitous API breakage.
This commit is contained in:
Edward Thomson
2024-12-23 11:53:23 +00:00
parent 9961198879
commit 56e2a85643
50 changed files with 427 additions and 334 deletions

View File

@@ -189,15 +189,9 @@ static void compute_diff_no_index(git_diff **diff, struct diff_options *o) {
git_patch_to_buf(&buf, patch),
"patch to buf", NULL);
#ifdef GIT_EXPERIMENTAL_SHA256
check_lg2(
git_diff_from_buffer(diff, buf.ptr, buf.size, NULL),
"diff from patch", NULL);
#else
check_lg2(
git_diff_from_buffer(diff, buf.ptr, buf.size),
"diff from patch", NULL);
#endif
git_patch_free(patch);
git_buf_dispose(&buf);