File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -856,6 +856,25 @@ int git_odb__open(
856856 return 0 ;
857857}
858858
859+ #ifdef GIT_EXPERIMENTAL_SHA256
860+
861+ int git_odb_open (
862+ git_odb * * out ,
863+ const char * objects_dir ,
864+ const git_odb_options * opts )
865+ {
866+ return git_odb__open (out , objects_dir , opts );
867+ }
868+
869+ #else
870+
871+ int git_odb_open (git_odb * * out , const char * objects_dir )
872+ {
873+ return git_odb__open (out , objects_dir , NULL );
874+ }
875+
876+ #endif
877+
859878int git_odb__set_caps (git_odb * odb , int caps )
860879{
861880 if (caps == GIT_ODB_CAP_FROM_OWNER ) {
Original file line number Diff line number Diff line change 1+ #include "clar_libgit2.h"
2+
3+ void test_odb_open__initialize (void )
4+ {
5+ cl_fixture_sandbox ("testrepo.git" );
6+ }
7+
8+ void test_odb_open__cleanup (void )
9+ {
10+ cl_fixture_cleanup ("testrepo.git" );
11+ }
12+
13+ void test_odb_open__exists (void )
14+ {
15+ git_odb * odb ;
16+ git_oid one , two ;
17+
18+ #ifdef GIT_EXPERIMENTAL_SHA256
19+ git_odb_options opts = GIT_ODB_OPTIONS_INIT ;
20+
21+ cl_git_pass (git_odb_open (& odb , "testrepo.git/objects" , & opts ));
22+ cl_git_pass (git_oid_fromstr (& one , "1385f264afb75a56a5bec74243be9b367ba4ca08" , GIT_OID_SHA1 ));
23+ cl_git_pass (git_oid_fromstr (& two , "00112233445566778899aabbccddeeff00112233" , GIT_OID_SHA1 ));
24+ #else
25+ cl_git_pass (git_odb_open (& odb , "testrepo.git/objects" ));
26+ cl_git_pass (git_oid_fromstr (& one , "1385f264afb75a56a5bec74243be9b367ba4ca08" ));
27+ cl_git_pass (git_oid_fromstr (& two , "00112233445566778899aabbccddeeff00112233" ));
28+ #endif
29+
30+ cl_assert (git_odb_exists (odb , & one ));
31+ cl_assert (!git_odb_exists (odb , & two ));
32+
33+ git_odb_free (odb );
34+ }
You can’t perform that action at this time.
0 commit comments