summaryrefslogtreecommitdiff
path: root/examples/rev-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rev-list.c')
-rw-r--r--examples/rev-list.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/rev-list.c b/examples/rev-list.c
index d10f16690..cf8ac30c6 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -26,7 +26,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv)
git_revwalk *walk;
git_oid oid;
git_sort_t sort;
- char buf[GIT_OID_HEXSZ+1];
+ char buf[GIT_OID_SHA1_HEXSIZE+1];
check_lg2(revwalk_parse_options(&sort, &args), "parsing options", NULL);
@@ -36,7 +36,7 @@ int lg2_rev_list(git_repository *repo, int argc, char **argv)
while (!git_revwalk_next(&oid, walk)) {
git_oid_fmt(buf, &oid);
- buf[GIT_OID_HEXSZ] = '\0';
+ buf[GIT_OID_SHA1_HEXSIZE] = '\0';
printf("%s\n", buf);
}
@@ -140,8 +140,14 @@ static int revwalk_parse_revs(git_repository *repo, git_revwalk *walk, struct ar
if (push_spec(repo, walk, curr, hide) == 0)
continue;
+#ifdef GIT_EXPERIMENTAL_SHA256
+ if ((error = git_oid_fromstr(&oid, curr, GIT_OID_SHA1)))
+ return error;
+#else
if ((error = git_oid_fromstr(&oid, curr)))
return error;
+#endif
+
if ((error = push_commit(walk, &oid, hide)))
return error;
}