@@ -47,7 +47,8 @@ void test_refs_rename__loose(void)
47
47
cl_git_pass (git_reference_lookup (& looked_up_ref , g_repo , loose_tag_ref_name ));
48
48
49
49
/* ... which is indeed loose */
50
- cl_assert (reference_is_packed (looked_up_ref ) == 0 );
50
+ if (cl_repo_has_ref_format (g_repo , "files" ))
51
+ cl_assert (reference_is_packed (looked_up_ref ) == 0 );
51
52
52
53
/* Now that the reference is renamed... */
53
54
cl_git_pass (git_reference_rename (& new_ref , looked_up_ref , new_name , 0 , NULL ));
@@ -62,12 +63,16 @@ void test_refs_rename__loose(void)
62
63
cl_assert_equal_s (new_ref -> name , new_name );
63
64
64
65
/* .. the new ref is loose... */
65
- cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
66
- cl_assert (reference_is_packed (new_ref ) == 0 );
66
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
67
+ cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
68
+ cl_assert (reference_is_packed (new_ref ) == 0 );
69
+ }
67
70
68
71
/* ...and the ref can be found in the file system */
69
- cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), new_name ));
70
- cl_assert (git_fs_path_exists (temp_path .ptr ));
72
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
73
+ cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), new_name ));
74
+ cl_assert (git_fs_path_exists (temp_path .ptr ));
75
+ }
71
76
72
77
git_reference_free (new_ref );
73
78
git_reference_free (another_looked_up_ref );
@@ -82,14 +87,17 @@ void test_refs_rename__packed(void)
82
87
const char * brand_new_name = "refs/heads/brand_new_name" ;
83
88
84
89
/* Ensure the ref doesn't exist on the file system */
85
- cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), packed_head_name ));
86
- cl_assert (!git_fs_path_exists (temp_path .ptr ));
90
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
91
+ cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), packed_head_name ));
92
+ cl_assert (!git_fs_path_exists (temp_path .ptr ));
93
+ }
87
94
88
95
/* The reference can however be looked-up... */
89
96
cl_git_pass (git_reference_lookup (& looked_up_ref , g_repo , packed_head_name ));
90
97
91
98
/* .. and it's packed */
92
- cl_assert (reference_is_packed (looked_up_ref ) != 0 );
99
+ if (cl_repo_has_ref_format (g_repo , "files" ))
100
+ cl_assert (reference_is_packed (looked_up_ref ) != 0 );
93
101
94
102
/* Now that the reference is renamed... */
95
103
cl_git_pass (git_reference_rename (& new_ref , looked_up_ref , brand_new_name , 0 , NULL ));
@@ -104,12 +112,16 @@ void test_refs_rename__packed(void)
104
112
cl_assert_equal_s (another_looked_up_ref -> name , brand_new_name );
105
113
106
114
/* .. the ref is no longer packed... */
107
- cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
108
- cl_assert (reference_is_packed (new_ref ) == 0 );
115
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
116
+ cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
117
+ cl_assert (reference_is_packed (new_ref ) == 0 );
118
+ }
109
119
110
120
/* ...and the ref now happily lives in the file system */
111
- cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), brand_new_name ));
112
- cl_assert (git_fs_path_exists (temp_path .ptr ));
121
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
122
+ cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), brand_new_name ));
123
+ cl_assert (git_fs_path_exists (temp_path .ptr ));
124
+ }
113
125
114
126
git_reference_free (new_ref );
115
127
git_reference_free (another_looked_up_ref );
@@ -124,21 +136,25 @@ void test_refs_rename__packed_doesnt_pack_others(void)
124
136
const char * brand_new_name = "refs/heads/brand_new_name" ;
125
137
126
138
/* Ensure the other reference exists on the file system */
127
- cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), packed_test_head_name ));
128
- cl_assert (git_fs_path_exists (temp_path .ptr ));
139
+ if (cl_repo_has_ref_format (g_repo , "files" )) {
140
+ cl_git_pass (git_str_joinpath (& temp_path , git_repository_path (g_repo ), packed_test_head_name ));
141
+ cl_assert (git_fs_path_exists (temp_path .ptr ));
142
+ }
129
143
130
144
/* Lookup the other reference */
131
145
cl_git_pass (git_reference_lookup (& another_looked_up_ref , g_repo , packed_test_head_name ));
132
146
133
147
/* Ensure it's loose */
134
- cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
148
+ if (cl_repo_has_ref_format (g_repo , "files" ))
149
+ cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
135
150
git_reference_free (another_looked_up_ref );
136
151
137
152
/* Lookup the reference to rename */
138
153
cl_git_pass (git_reference_lookup (& looked_up_ref , g_repo , packed_head_name ));
139
154
140
155
/* Ensure it's packed */
141
- cl_assert (reference_is_packed (looked_up_ref ) != 0 );
156
+ if (cl_repo_has_ref_format (g_repo , "files" ))
157
+ cl_assert (reference_is_packed (looked_up_ref ) != 0 );
142
158
143
159
/* Now that the reference is renamed... */
144
160
cl_git_pass (git_reference_rename (& renamed_ref , looked_up_ref , brand_new_name , 0 , NULL ));
@@ -148,10 +164,12 @@ void test_refs_rename__packed_doesnt_pack_others(void)
148
164
cl_git_pass (git_reference_lookup (& another_looked_up_ref , g_repo , packed_test_head_name ));
149
165
150
166
/* Ensure it's loose */
151
- cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
167
+ if (cl_repo_has_ref_format (g_repo , "files" ))
168
+ cl_assert (reference_is_packed (another_looked_up_ref ) == 0 );
152
169
153
170
/* Ensure the other ref still exists on the file system */
154
- cl_assert (git_fs_path_exists (temp_path .ptr ));
171
+ if (cl_repo_has_ref_format (g_repo , "files" ))
172
+ cl_assert (git_fs_path_exists (temp_path .ptr ));
155
173
156
174
git_reference_free (renamed_ref );
157
175
git_reference_free (another_looked_up_ref );
0 commit comments