1 #include "clar_libgit2.h"
3 #include "git2/clone.h"
4 #include "git2/transport.h"
5 #include "git2/sys/transport.h"
8 static int custom_transport(
15 return git_transport_local(out
, owner
, payload
);
18 static int custom_transport_remote_create(
29 if ((error
= git_remote_create(out
, repo
, name
, url
)) < 0)
35 void test_clone_transport__custom_transport(void)
38 git_clone_options clone_opts
= GIT_CLONE_OPTIONS_INIT
;
39 int custom_transport_used
= 0;
41 clone_opts
.remote_cb
= custom_transport_remote_create
;
42 clone_opts
.fetch_opts
.callbacks
.transport
= custom_transport
;
43 clone_opts
.fetch_opts
.callbacks
.payload
= &custom_transport_used
;
45 cl_git_pass(git_clone(&repo
, cl_fixture("testrepo.git"), "./custom_transport.git", &clone_opts
));
46 git_repository_free(repo
);
48 cl_git_pass(git_futils_rmdir_r("./custom_transport.git", NULL
, GIT_RMDIR_REMOVE_FILES
));
50 cl_assert(custom_transport_used
== 1);