summaryrefslogtreecommitdiff
path: root/examples/diff.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-04-07 15:28:58 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-04-10 14:21:16 +0100
commitdb2a794dda2b6f92291b3758507f863f39314c72 (patch)
tree53c5b2d77c6c38cf26fecc90e91809df0397fa46 /examples/diff.c
parent7f70484799df14dbc666b3c395ded690d1a5a402 (diff)
downloadlibgit2-db2a794dda2b6f92291b3758507f863f39314c72.tar.gz
diff: parse patches with sha256
Diffstat (limited to 'examples/diff.c')
-rw-r--r--examples/diff.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/diff.c b/examples/diff.c
index a9fb5d442..80c5200e9 100644
--- a/examples/diff.c
+++ b/examples/diff.c
@@ -188,9 +188,17 @@ static void compute_diff_no_index(git_diff **diff, struct diff_options *o) {
check_lg2(
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);
free(file1_str);