diff options
| author | Graham Dennis <graham.dennis@gmail.com> | 2014-01-18 08:43:29 +1100 |
|---|---|---|
| committer | Graham Dennis <graham.dennis@gmail.com> | 2014-01-18 08:43:29 +1100 |
| commit | 194d077c4f6eeea0451753bf5f43355f6520a359 (patch) | |
| tree | e747542a77179905562683eb122a98c70252f46c /tests/network | |
| parent | 4e974c971f39ac5e72bf656b49e43f208146d29e (diff) | |
| download | libgit2-194d077c4f6eeea0451753bf5f43355f6520a359.tar.gz | |
Add test for pushing to a local file:// URL.
Diffstat (limited to 'tests/network')
| -rw-r--r-- | tests/network/remote/local.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c index 309142925..2ec5780e5 100644 --- a/tests/network/remote/local.c +++ b/tests/network/remote/local.c @@ -197,6 +197,46 @@ void test_network_remote_local__push_to_bare_remote(void) cl_fixture_cleanup("localbare.git"); } +void test_network_remote_local__push_to_bare_remote_with_file_url(void) +{ + /* Should be able to push to a bare remote */ + git_remote *localremote; + git_push *push; + + /* Get some commits */ + connect_to_local_repository(cl_fixture("testrepo.git")); + cl_git_pass(git_remote_add_fetch(remote, "master:master")); + cl_git_pass(git_remote_download(remote)); + cl_git_pass(git_remote_update_tips(remote)); + git_remote_disconnect(remote); + + /* Set up an empty bare repo to push into */ + { + git_repository *localbarerepo; + cl_git_pass(git_repository_init(&localbarerepo, "./localbare.git", 1)); + git_repository_free(localbarerepo); + } + + /* Create a file URL */ + char *url = cl_git_path_url("./localbare.git"); + + /* Connect to the bare repo */ + cl_git_pass(git_remote_create_inmemory(&localremote, repo, NULL, url)); + cl_git_pass(git_remote_connect(localremote, GIT_DIRECTION_PUSH)); + + /* Try to push */ + cl_git_pass(git_push_new(&push, localremote)); + cl_git_pass(git_push_add_refspec(push, "refs/heads/master:")); + cl_git_pass(git_push_finish(push)); + cl_assert(git_push_unpack_ok(push)); + + /* Clean up */ + git_push_free(push); + git_remote_free(localremote); + cl_fixture_cleanup("localbare.git"); +} + + void test_network_remote_local__push_to_non_bare_remote(void) { /* Shouldn't be able to push to a non-bare remote */ |
