@@ -142,7 +142,11 @@ static void oid_parsing(git_oid *oid)
142142 * this throughout the example for storing the value of the current SHA
143143 * key we're working with.
144144 */
145+ #ifdef GIT_EXPERIMENTAL_SHA256
145146 git_oid_fromstr (oid , hex , GIT_OID_SHA1 );
147+ #else
148+ git_oid_fromstr (oid , hex );
149+ #endif
146150
147151 /*
148152 * Once we've converted the string into the oid value, we can get the raw
@@ -287,9 +291,14 @@ static void commit_writing(git_repository *repo)
287291 * parents. Here we're creating oid objects to create the commit with,
288292 * but you can also use
289293 */
294+ #ifdef GIT_EXPERIMENTAL_SHA256
290295 git_oid_fromstr (& tree_id , "f60079018b664e4e79329a7ef9559c8d9e0378d1" , GIT_OID_SHA1 );
291- git_tree_lookup (& tree , repo , & tree_id );
292296 git_oid_fromstr (& parent_id , "5b5b025afb0b4c913b4c338a42934a3863bf3644" , GIT_OID_SHA1 );
297+ #else
298+ git_oid_fromstr (& tree_id , "f60079018b664e4e79329a7ef9559c8d9e0378d1" );
299+ git_oid_fromstr (& parent_id , "5b5b025afb0b4c913b4c338a42934a3863bf3644" );
300+ #endif
301+ git_tree_lookup (& tree , repo , & tree_id );
293302 git_commit_lookup (& parent , repo , & parent_id );
294303
295304 /**
@@ -353,7 +362,11 @@ static void commit_parsing(git_repository *repo)
353362
354363 printf ("\n*Commit Parsing*\n" );
355364
365+ #ifdef GIT_EXPERIMENTAL_SHA256
356366 git_oid_fromstr (& oid , "8496071c1b46c854b31185ea97743be6a8774479" , GIT_OID_SHA1 );
367+ #else
368+ git_oid_fromstr (& oid , "8496071c1b46c854b31185ea97743be6a8774479" );
369+ #endif
357370
358371 error = git_commit_lookup (& commit , repo , & oid );
359372 check_error (error , "looking up commit" );
@@ -422,7 +435,11 @@ static void tag_parsing(git_repository *repo)
422435 * We create an oid for the tag object if we know the SHA and look it up
423436 * the same way that we would a commit (or any other object).
424437 */
438+ #ifdef GIT_EXPERIMENTAL_SHA256
425439 git_oid_fromstr (& oid , "b25fa35b38051e4ae45d4222e795f9df2e43f1d1" , GIT_OID_SHA1 );
440+ #else
441+ git_oid_fromstr (& oid , "b25fa35b38051e4ae45d4222e795f9df2e43f1d1" );
442+ #endif
426443
427444 error = git_tag_lookup (& tag , repo , & oid );
428445 check_error (error , "looking up tag" );
@@ -470,7 +487,11 @@ static void tree_parsing(git_repository *repo)
470487 /**
471488 * Create the oid and lookup the tree object just like the other objects.
472489 */
490+ #ifdef GIT_EXPERIMENTAL_SHA256
473491 git_oid_fromstr (& oid , "f60079018b664e4e79329a7ef9559c8d9e0378d1" , GIT_OID_SHA1 );
492+ #else
493+ git_oid_fromstr (& oid , "f60079018b664e4e79329a7ef9559c8d9e0378d1" );
494+ #endif
474495 git_tree_lookup (& tree , repo , & oid );
475496
476497 /**
@@ -524,7 +545,11 @@ static void blob_parsing(git_repository *repo)
524545
525546 printf ("\n*Blob Parsing*\n" );
526547
548+ #ifdef GIT_EXPERIMENTAL_SHA256
527549 git_oid_fromstr (& oid , "1385f264afb75a56a5bec74243be9b367ba4ca08" , GIT_OID_SHA1 );
550+ #else
551+ git_oid_fromstr (& oid , "1385f264afb75a56a5bec74243be9b367ba4ca08" );
552+ #endif
528553 git_blob_lookup (& blob , repo , & oid );
529554
530555 /**
@@ -566,7 +591,11 @@ static void revwalking(git_repository *repo)
566591
567592 printf ("\n*Revwalking*\n" );
568593
594+ #ifdef GIT_EXPERIMENTAL_SHA256
569595 git_oid_fromstr (& oid , "5b5b025afb0b4c913b4c338a42934a3863bf3644" , GIT_OID_SHA1 );
596+ #else
597+ git_oid_fromstr (& oid , "5b5b025afb0b4c913b4c338a42934a3863bf3644" );
598+ #endif
570599
571600 /**
572601 * To use the revwalker, create a new walker, tell it how you want to sort
0 commit comments