@@ -5,7 +5,11 @@ void test_repo_new__has_nothing(void)
5
5
{
6
6
git_repository * repo ;
7
7
8
+ #ifdef GIT_EXPERIMENTAL_SHA256
9
+ cl_git_pass (git_repository_new (& repo , GIT_OID_SHA1 ));
10
+ #else
8
11
cl_git_pass (git_repository_new (& repo ));
12
+ #endif
9
13
cl_assert_equal_b (true, git_repository_is_bare (repo ));
10
14
cl_assert_equal_p (NULL , git_repository_path (repo ));
11
15
cl_assert_equal_p (NULL , git_repository_workdir (repo ));
@@ -16,7 +20,11 @@ void test_repo_new__is_bare_until_workdir_set(void)
16
20
{
17
21
git_repository * repo ;
18
22
23
+ #ifdef GIT_EXPERIMENTAL_SHA256
24
+ cl_git_pass (git_repository_new (& repo , GIT_OID_SHA1 ));
25
+ #else
19
26
cl_git_pass (git_repository_new (& repo ));
27
+ #endif
20
28
cl_assert_equal_b (true, git_repository_is_bare (repo ));
21
29
22
30
cl_git_pass (git_repository_set_workdir (repo , clar_sandbox_path (), 0 ));
@@ -25,3 +33,30 @@ void test_repo_new__is_bare_until_workdir_set(void)
25
33
git_repository_free (repo );
26
34
}
27
35
36
+ void test_repo_new__sha1 (void )
37
+ {
38
+ git_repository * repo ;
39
+
40
+ #ifdef GIT_EXPERIMENTAL_SHA256
41
+ cl_git_pass (git_repository_new (& repo , GIT_OID_SHA1 ));
42
+ #else
43
+ cl_git_pass (git_repository_new (& repo ));
44
+ #endif
45
+ cl_assert_equal_i (GIT_OID_SHA1 , git_repository_oid_type (repo ));
46
+
47
+ git_repository_free (repo );
48
+ }
49
+
50
+ void test_repo_new__sha256 (void )
51
+ {
52
+ #ifndef GIT_EXPERIMENTAL_SHA256
53
+ cl_skip ();
54
+ #else
55
+ git_repository * repo ;
56
+
57
+ cl_git_pass (git_repository_new (& repo , GIT_OID_SHA256 ));
58
+ cl_assert_equal_i (GIT_OID_SHA256 , git_repository_oid_type (repo ));
59
+
60
+ git_repository_free (repo );
61
+ #endif
62
+ }
0 commit comments