mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user