summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-04-05 10:39:01 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-04-10 11:02:12 +0100
commit523f893f6fac92e301b090b141b449183947e3b3 (patch)
tree11202ec3ccefc96deaf9719f792a7fc240f05b34 /examples
parentc616ba2d1ebab52af0315235932659d81d238876 (diff)
downloadlibgit2-523f893f6fac92e301b090b141b449183947e3b3.tar.gz
index: add sha256 support
Diffstat (limited to 'examples')
-rw-r--r--examples/show-index.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/show-index.c b/examples/show-index.c
index fb797e04b..0a5e7d1a2 100644
--- a/examples/show-index.c
+++ b/examples/show-index.c
@@ -30,7 +30,11 @@ int lg2_show_index(git_repository *repo, int argc, char **argv)
dirlen = strlen(dir);
if (dirlen > 5 && strcmp(dir + dirlen - 5, "index") == 0) {
+#ifdef GIT_EXPERIMENTAL_SHA256
+ check_lg2(git_index_open(&index, dir, GIT_OID_SHA1), "could not open index", dir);
+#else
check_lg2(git_index_open(&index, dir), "could not open index", dir);
+#endif
} else {
check_lg2(git_repository_open_ext(&repo, dir, 0, NULL), "could not open repository", dir);
check_lg2(git_repository_index(&index, repo), "could not open repository index", NULL);