]>
Commit | Line | Data |
---|---|---|
3fd1520c | 1 | #include "clar_libgit2.h" |
db1f7e59 | 2 | #include "buffer.h" |
3 | #include "path.h" | |
e2580375 | 4 | #include "posix.h" |
bee423cc | 5 | #include "git2/sys/repository.h" |
db1f7e59 | 6 | |
7 | static git_repository *repo; | |
8 | static git_buf file_path_buf = GIT_BUF_INIT; | |
9 | static git_remote *remote; | |
10 | ||
fe794b2e CMN |
11 | static char *push_refspec_strings[] = { |
12 | "refs/heads/master", | |
13 | }; | |
14 | static git_strarray push_array = { | |
15 | push_refspec_strings, | |
16 | 1, | |
17 | }; | |
18 | ||
624924e8 | 19 | void test_network_remote_local__initialize(void) |
db1f7e59 | 20 | { |
db1f7e59 | 21 | cl_git_pass(git_repository_init(&repo, "remotelocal/", 0)); |
659cf202 | 22 | cl_git_pass(git_repository_set_ident(repo, "Foo Bar", "foo@example.com")); |
db1f7e59 | 23 | cl_assert(repo != NULL); |
db1f7e59 | 24 | } |
25 | ||
624924e8 | 26 | void test_network_remote_local__cleanup(void) |
db1f7e59 | 27 | { |
ac3d33df | 28 | git_buf_dispose(&file_path_buf); |
9094d30b SC |
29 | |
30 | git_remote_free(remote); | |
31 | remote = NULL; | |
32 | ||
db1f7e59 | 33 | git_repository_free(repo); |
9094d30b SC |
34 | repo = NULL; |
35 | ||
db1f7e59 | 36 | cl_fixture_cleanup("remotelocal"); |
37 | } | |
38 | ||
e2580375 | 39 | static void connect_to_local_repository(const char *local_repository) |
40 | { | |
2ff1a0d0 | 41 | git_buf_sets(&file_path_buf, cl_git_path_url(local_repository)); |
e2580375 | 42 | |
ae5b9362 | 43 | cl_git_pass(git_remote_create_anonymous(&remote, repo, git_buf_cstr(&file_path_buf))); |
07bd3e57 | 44 | cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL, NULL, NULL)); |
e2580375 | 45 | } |
46 | ||
624924e8 | 47 | void test_network_remote_local__connected(void) |
36c88422 AS |
48 | { |
49 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
50 | cl_assert(git_remote_connected(remote)); | |
51 | ||
52 | git_remote_disconnect(remote); | |
53 | cl_assert(!git_remote_connected(remote)); | |
54 | } | |
55 | ||
624924e8 | 56 | void test_network_remote_local__retrieve_advertised_references(void) |
db1f7e59 | 57 | { |
359dce72 CMN |
58 | const git_remote_head **refs; |
59 | size_t refs_len; | |
db1f7e59 | 60 | |
e2580375 | 61 | connect_to_local_repository(cl_fixture("testrepo.git")); |
62 | ||
359dce72 | 63 | cl_git_pass(git_remote_ls(&refs, &refs_len, remote)); |
db1f7e59 | 64 | |
22a2d3d5 | 65 | cl_assert_equal_i(refs_len, 29); |
db1f7e59 | 66 | } |
e2580375 | 67 | |
dc8adda4 JG |
68 | void test_network_remote_local__retrieve_advertised_before_connect(void) |
69 | { | |
70 | const git_remote_head **refs; | |
71 | size_t refs_len = 0; | |
72 | ||
73 | git_buf_sets(&file_path_buf, cl_git_path_url(cl_fixture("testrepo.git"))); | |
74 | ||
ae5b9362 | 75 | cl_git_pass(git_remote_create_anonymous(&remote, repo, git_buf_cstr(&file_path_buf))); |
dc8adda4 JG |
76 | cl_git_fail(git_remote_ls(&refs, &refs_len, remote)); |
77 | } | |
78 | ||
edbaa63a AS |
79 | void test_network_remote_local__retrieve_advertised_references_after_disconnect(void) |
80 | { | |
359dce72 CMN |
81 | const git_remote_head **refs; |
82 | size_t refs_len; | |
edbaa63a AS |
83 | |
84 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
85 | git_remote_disconnect(remote); | |
86 | ||
359dce72 | 87 | cl_git_pass(git_remote_ls(&refs, &refs_len, remote)); |
edbaa63a | 88 | |
22a2d3d5 | 89 | cl_assert_equal_i(refs_len, 29); |
edbaa63a AS |
90 | } |
91 | ||
624924e8 | 92 | void test_network_remote_local__retrieve_advertised_references_from_spaced_repository(void) |
e2580375 | 93 | { |
359dce72 CMN |
94 | const git_remote_head **refs; |
95 | size_t refs_len; | |
e2580375 | 96 | |
97 | cl_fixture_sandbox("testrepo.git"); | |
98 | cl_git_pass(p_rename("testrepo.git", "spaced testrepo.git")); | |
99 | ||
100 | connect_to_local_repository("spaced testrepo.git"); | |
101 | ||
359dce72 | 102 | cl_git_pass(git_remote_ls(&refs, &refs_len, remote)); |
e2580375 | 103 | |
22a2d3d5 | 104 | cl_assert_equal_i(refs_len, 29); |
e2580375 | 105 | |
79fd4230 | 106 | git_remote_free(remote); /* Disconnect from the "spaced repo" before the cleanup */ |
107 | remote = NULL; | |
108 | ||
e2580375 | 109 | cl_fixture_cleanup("spaced testrepo.git"); |
110 | } | |
79fd4230 | 111 | |
624924e8 | 112 | void test_network_remote_local__nested_tags_are_completely_peeled(void) |
79fd4230 | 113 | { |
359dce72 CMN |
114 | const git_remote_head **refs; |
115 | size_t refs_len, i; | |
116 | ||
79fd4230 | 117 | connect_to_local_repository(cl_fixture("testrepo.git")); |
118 | ||
359dce72 CMN |
119 | cl_git_pass(git_remote_ls(&refs, &refs_len, remote)); |
120 | ||
121 | for (i = 0; i < refs_len; i++) { | |
122 | if (!strcmp(refs[i]->name, "refs/tags/test^{}")) | |
123 | cl_git_pass(git_oid_streq(&refs[i]->oid, "e90810b8df3e80c413d903f631643c716887138d")); | |
124 | } | |
79fd4230 | 125 | } |
d8488457 CMN |
126 | |
127 | void test_network_remote_local__shorthand_fetch_refspec0(void) | |
128 | { | |
9c206a22 CMN |
129 | char *refspec_strings[] = { |
130 | "master:remotes/sloppy/master", | |
131 | "master:boh/sloppy/master", | |
132 | }; | |
133 | git_strarray array = { | |
134 | refspec_strings, | |
135 | 2, | |
136 | }; | |
d8488457 CMN |
137 | |
138 | git_reference *ref; | |
139 | ||
140 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
d8488457 | 141 | |
8f0104ec | 142 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
d8488457 CMN |
143 | |
144 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); | |
145 | git_reference_free(ref); | |
146 | ||
147 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/heads/boh/sloppy/master")); | |
148 | git_reference_free(ref); | |
149 | } | |
150 | ||
151 | void test_network_remote_local__shorthand_fetch_refspec1(void) | |
152 | { | |
9c206a22 CMN |
153 | char *refspec_strings[] = { |
154 | "master", | |
155 | "hard_tag", | |
156 | }; | |
157 | git_strarray array = { | |
158 | refspec_strings, | |
159 | 2, | |
160 | }; | |
d8488457 CMN |
161 | |
162 | git_reference *ref; | |
163 | ||
164 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
d8488457 | 165 | |
8f0104ec | 166 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
d8488457 | 167 | |
35a8a8c5 | 168 | cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/origin/master")); |
d8488457 CMN |
169 | cl_git_fail(git_reference_lookup(&ref, repo, "refs/tags/hard_tag")); |
170 | } | |
505b5d0c CMN |
171 | |
172 | void test_network_remote_local__tagopt(void) | |
173 | { | |
174 | git_reference *ref; | |
35a8a8c5 | 175 | git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; |
505b5d0c | 176 | |
ea8dedc9 | 177 | cl_git_pass(git_remote_create(&remote, repo, "tagopt", cl_git_path_url(cl_fixture("testrepo.git")))); |
35a8a8c5 CMN |
178 | fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL; |
179 | cl_git_pass(git_remote_fetch(remote, NULL, &fetch_opts, NULL)); | |
505b5d0c | 180 | |
e284c451 | 181 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); |
f7fcb18f | 182 | git_reference_free(ref); |
505b5d0c CMN |
183 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/tags/hard_tag")); |
184 | git_reference_free(ref); | |
ea8dedc9 | 185 | |
35a8a8c5 CMN |
186 | fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO; |
187 | cl_git_pass(git_remote_fetch(remote, NULL, &fetch_opts, NULL)); | |
ea8dedc9 | 188 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/tagopt/master")); |
f7fcb18f | 189 | git_reference_free(ref); |
505b5d0c | 190 | } |
61d57b7a BS |
191 | |
192 | void test_network_remote_local__push_to_bare_remote(void) | |
193 | { | |
9c206a22 CMN |
194 | char *refspec_strings[] = { |
195 | "master:master", | |
196 | }; | |
197 | git_strarray array = { | |
198 | refspec_strings, | |
199 | 1, | |
200 | }; | |
fe794b2e | 201 | |
61d57b7a BS |
202 | /* Should be able to push to a bare remote */ |
203 | git_remote *localremote; | |
61d57b7a BS |
204 | |
205 | /* Get some commits */ | |
206 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
8f0104ec | 207 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
61d57b7a BS |
208 | |
209 | /* Set up an empty bare repo to push into */ | |
210 | { | |
211 | git_repository *localbarerepo; | |
212 | cl_git_pass(git_repository_init(&localbarerepo, "./localbare.git", 1)); | |
213 | git_repository_free(localbarerepo); | |
214 | } | |
215 | ||
216 | /* Connect to the bare repo */ | |
ae5b9362 | 217 | cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localbare.git")); |
07bd3e57 | 218 | cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL)); |
61d57b7a BS |
219 | |
220 | /* Try to push */ | |
0bc3d56d | 221 | cl_git_pass(git_remote_upload(localremote, &push_array, NULL)); |
61d57b7a BS |
222 | |
223 | /* Clean up */ | |
224 | git_remote_free(localremote); | |
225 | cl_fixture_cleanup("localbare.git"); | |
226 | } | |
227 | ||
194d077c GD |
228 | void test_network_remote_local__push_to_bare_remote_with_file_url(void) |
229 | { | |
9c206a22 CMN |
230 | char *refspec_strings[] = { |
231 | "master:master", | |
232 | }; | |
233 | git_strarray array = { | |
234 | refspec_strings, | |
235 | 1, | |
236 | }; | |
194d077c GD |
237 | /* Should be able to push to a bare remote */ |
238 | git_remote *localremote; | |
66d585c6 | 239 | const char *url; |
194d077c GD |
240 | |
241 | /* Get some commits */ | |
242 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
35a8a8c5 | 243 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
194d077c GD |
244 | |
245 | /* Set up an empty bare repo to push into */ | |
246 | { | |
247 | git_repository *localbarerepo; | |
248 | cl_git_pass(git_repository_init(&localbarerepo, "./localbare.git", 1)); | |
249 | git_repository_free(localbarerepo); | |
250 | } | |
251 | ||
252 | /* Create a file URL */ | |
66d585c6 | 253 | url = cl_git_path_url("./localbare.git"); |
194d077c GD |
254 | |
255 | /* Connect to the bare repo */ | |
ae5b9362 | 256 | cl_git_pass(git_remote_create_anonymous(&localremote, repo, url)); |
07bd3e57 | 257 | cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL)); |
194d077c GD |
258 | |
259 | /* Try to push */ | |
0bc3d56d | 260 | cl_git_pass(git_remote_upload(localremote, &push_array, NULL)); |
194d077c GD |
261 | |
262 | /* Clean up */ | |
194d077c GD |
263 | git_remote_free(localremote); |
264 | cl_fixture_cleanup("localbare.git"); | |
265 | } | |
266 | ||
267 | ||
61d57b7a BS |
268 | void test_network_remote_local__push_to_non_bare_remote(void) |
269 | { | |
9c206a22 CMN |
270 | char *refspec_strings[] = { |
271 | "master:master", | |
272 | }; | |
273 | git_strarray array = { | |
274 | refspec_strings, | |
275 | 1, | |
276 | }; | |
61d57b7a BS |
277 | /* Shouldn't be able to push to a non-bare remote */ |
278 | git_remote *localremote; | |
35a8a8c5 | 279 | git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT; |
61d57b7a BS |
280 | |
281 | /* Get some commits */ | |
282 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
35a8a8c5 | 283 | cl_git_pass(git_remote_fetch(remote, &array, &fetch_opts, NULL)); |
61d57b7a BS |
284 | |
285 | /* Set up an empty non-bare repo to push into */ | |
286 | { | |
287 | git_repository *remoterepo = NULL; | |
288 | cl_git_pass(git_repository_init(&remoterepo, "localnonbare", 0)); | |
289 | git_repository_free(remoterepo); | |
290 | } | |
291 | ||
292 | /* Connect to the bare repo */ | |
ae5b9362 | 293 | cl_git_pass(git_remote_create_anonymous(&localremote, repo, "./localnonbare")); |
07bd3e57 | 294 | cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH, NULL, NULL, NULL)); |
61d57b7a BS |
295 | |
296 | /* Try to push */ | |
fe794b2e | 297 | cl_git_fail_with(GIT_EBAREREPO, git_remote_upload(localremote, &push_array, NULL)); |
61d57b7a BS |
298 | |
299 | /* Clean up */ | |
300 | git_remote_free(localremote); | |
301 | cl_fixture_cleanup("localbare.git"); | |
302 | } | |
c3ab1e5a BS |
303 | |
304 | void test_network_remote_local__fetch(void) | |
305 | { | |
9c206a22 CMN |
306 | char *refspec_strings[] = { |
307 | "master:remotes/sloppy/master", | |
308 | }; | |
309 | git_strarray array = { | |
310 | refspec_strings, | |
311 | 1, | |
312 | }; | |
c3ab1e5a BS |
313 | |
314 | git_reflog *log; | |
315 | const git_reflog_entry *entry; | |
c3ab1e5a BS |
316 | git_reference *ref; |
317 | ||
c3ab1e5a | 318 | connect_to_local_repository(cl_fixture("testrepo.git")); |
c3ab1e5a | 319 | |
8f0104ec | 320 | cl_git_pass(git_remote_fetch(remote, &array, NULL, "UPDAAAAAATE!!")); |
c3ab1e5a BS |
321 | |
322 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); | |
323 | git_reference_free(ref); | |
324 | ||
325 | cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); | |
326 | cl_assert_equal_i(1, git_reflog_entrycount(log)); | |
327 | entry = git_reflog_entry_byindex(log, 0); | |
328 | cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email); | |
329 | cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry)); | |
330 | ||
331 | git_reflog_free(log); | |
c3ab1e5a BS |
332 | } |
333 | ||
334 | void test_network_remote_local__reflog(void) | |
335 | { | |
9c206a22 CMN |
336 | char *refspec_strings[] = { |
337 | "master:remotes/sloppy/master", | |
338 | }; | |
339 | git_strarray array = { | |
340 | refspec_strings, | |
341 | 1, | |
342 | }; | |
c3ab1e5a BS |
343 | |
344 | git_reflog *log; | |
345 | const git_reflog_entry *entry; | |
c3ab1e5a BS |
346 | |
347 | connect_to_local_repository(cl_fixture("testrepo.git")); | |
c3ab1e5a | 348 | |
35a8a8c5 | 349 | cl_git_pass(git_remote_fetch(remote, &array, NULL, "UPDAAAAAATE!!")); |
c3ab1e5a BS |
350 | |
351 | cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); | |
352 | cl_assert_equal_i(1, git_reflog_entrycount(log)); | |
353 | entry = git_reflog_entry_byindex(log, 0); | |
354 | cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email); | |
355 | cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry)); | |
356 | ||
357 | git_reflog_free(log); | |
c3ab1e5a | 358 | } |
db55bb73 BS |
359 | |
360 | void test_network_remote_local__fetch_default_reflog_message(void) | |
361 | { | |
9c206a22 CMN |
362 | char *refspec_strings[] = { |
363 | "master:remotes/sloppy/master", | |
364 | }; | |
365 | git_strarray array = { | |
366 | refspec_strings, | |
367 | 1, | |
368 | }; | |
db55bb73 BS |
369 | |
370 | git_reflog *log; | |
371 | const git_reflog_entry *entry; | |
db55bb73 BS |
372 | char expected_reflog_msg[1024]; |
373 | ||
db55bb73 | 374 | connect_to_local_repository(cl_fixture("testrepo.git")); |
db55bb73 | 375 | |
8f0104ec | 376 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
db55bb73 BS |
377 | |
378 | cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master")); | |
379 | cl_assert_equal_i(1, git_reflog_entrycount(log)); | |
380 | entry = git_reflog_entry_byindex(log, 0); | |
381 | cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email); | |
382 | ||
383 | sprintf(expected_reflog_msg, "fetch %s", git_remote_url(remote)); | |
384 | cl_assert_equal_s(expected_reflog_msg, git_reflog_entry_message(entry)); | |
385 | ||
386 | git_reflog_free(log); | |
db55bb73 | 387 | } |
c5837cad CMN |
388 | |
389 | void test_network_remote_local__opportunistic_update(void) | |
390 | { | |
391 | git_reference *ref; | |
392 | char *refspec_strings[] = { | |
393 | "master", | |
394 | }; | |
395 | git_strarray array = { | |
396 | refspec_strings, | |
397 | 1, | |
398 | }; | |
399 | ||
400 | /* this remote has a passive refspec of "refs/heads/<star>:refs/remotes/origin/<star>" */ | |
401 | cl_git_pass(git_remote_create(&remote, repo, "origin", cl_git_fixture_url("testrepo.git"))); | |
402 | /* and we pass the active refspec "master" */ | |
8f0104ec | 403 | cl_git_pass(git_remote_fetch(remote, &array, NULL, NULL)); |
c5837cad CMN |
404 | |
405 | /* and we expect that to update our copy of origin's master */ | |
406 | cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/origin/master")); | |
407 | git_reference_free(ref); | |
408 | } | |
d3cd7da5 POL |
409 | |
410 | void test_network_remote_local__update_tips_for_new_remote(void) { | |
411 | git_repository *src_repo; | |
412 | git_repository *dst_repo; | |
413 | git_remote *new_remote; | |
d3cd7da5 POL |
414 | git_reference* branch; |
415 | ||
416 | /* Copy test repo */ | |
417 | cl_fixture_sandbox("testrepo.git"); | |
418 | cl_git_pass(git_repository_open(&src_repo, "testrepo.git")); | |
419 | ||
420 | /* Set up an empty bare repo to push into */ | |
421 | cl_git_pass(git_repository_init(&dst_repo, "./localbare.git", 1)); | |
422 | ||
423 | /* Push to bare repo */ | |
424 | cl_git_pass(git_remote_create(&new_remote, src_repo, "bare", "./localbare.git")); | |
8f0104ec CMN |
425 | cl_git_pass(git_remote_push(new_remote, &push_array, NULL)); |
426 | /* Make sure remote branch has been created */ | |
d3cd7da5 POL |
427 | cl_git_pass(git_branch_lookup(&branch, src_repo, "bare/master", GIT_BRANCH_REMOTE)); |
428 | ||
429 | git_reference_free(branch); | |
d3cd7da5 POL |
430 | git_remote_free(new_remote); |
431 | git_repository_free(dst_repo); | |
432 | cl_fixture_cleanup("localbare.git"); | |
433 | git_repository_free(src_repo); | |
434 | cl_fixture_cleanup("testrepo.git"); | |
435 | } | |
3fade40e CMN |
436 | |
437 | void test_network_remote_local__push_delete(void) | |
438 | { | |
439 | git_repository *src_repo; | |
440 | git_repository *dst_repo; | |
441 | git_remote *remote; | |
442 | git_reference *ref; | |
443 | char *spec_push[] = { "refs/heads/master" }; | |
444 | char *spec_delete[] = { ":refs/heads/master" }; | |
445 | git_strarray specs = { | |
446 | spec_push, | |
447 | 1, | |
448 | }; | |
449 | ||
450 | src_repo = cl_git_sandbox_init("testrepo.git"); | |
451 | cl_git_pass(git_repository_init(&dst_repo, "target.git", 1)); | |
452 | ||
453 | cl_git_pass(git_remote_create(&remote, src_repo, "origin", "./target.git")); | |
454 | ||
455 | /* Push the master branch and verify it's there */ | |
412a3808 | 456 | cl_git_pass(git_remote_push(remote, &specs, NULL)); |
3fade40e CMN |
457 | cl_git_pass(git_reference_lookup(&ref, dst_repo, "refs/heads/master")); |
458 | git_reference_free(ref); | |
459 | ||
460 | specs.strings = spec_delete; | |
412a3808 | 461 | cl_git_pass(git_remote_push(remote, &specs, NULL)); |
3fade40e CMN |
462 | cl_git_fail(git_reference_lookup(&ref, dst_repo, "refs/heads/master")); |
463 | ||
3fade40e CMN |
464 | git_remote_free(remote); |
465 | git_repository_free(dst_repo); | |
d226fbf1 L |
466 | cl_fixture_cleanup("target.git"); |
467 | cl_git_sandbox_cleanup(); | |
3fade40e | 468 | } |
fe9a5dd3 ET |
469 | |
470 | void test_network_remote_local__anonymous_remote_inmemory_repo(void) | |
471 | { | |
472 | git_repository *inmemory; | |
473 | git_remote *remote; | |
474 | ||
475 | git_buf_sets(&file_path_buf, cl_git_path_url(cl_fixture("testrepo.git"))); | |
476 | ||
477 | cl_git_pass(git_repository_new(&inmemory)); | |
478 | cl_git_pass(git_remote_create_anonymous(&remote, inmemory, git_buf_cstr(&file_path_buf))); | |
479 | cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL, NULL, NULL)); | |
480 | cl_assert(git_remote_connected(remote)); | |
481 | git_remote_disconnect(remote); | |
482 | git_remote_free(remote); | |
483 | git_repository_free(inmemory); | |
484 | } |