]> git.proxmox.com Git - libgit2.git/blobdiff - tests/submodule/modify.c
New upstream version 1.1.0+dfsg.1
[libgit2.git] / tests / submodule / modify.c
index f7a089e7265a2487b89c454f56c7498b87c59b68..654f677e606e7a0872fd8eceb1f4e005cea5961b 100644 (file)
@@ -210,3 +210,24 @@ void test_submodule_modify__set_url(void)
        cl_assert_equal_s(SM_LIBGIT2_URL, git_submodule_url(sm));
        git_submodule_free(sm);
 }
+
+void test_submodule_modify__set_relative_url(void)
+{
+       git_buf path = GIT_BUF_INIT;
+       git_repository *repo;
+       git_submodule *sm;
+
+       cl_git_pass(git_submodule_set_url(g_repo, SM1, "../relative-url"));
+       cl_git_pass(git_submodule_lookup(&sm, g_repo, SM1));
+       cl_git_pass(git_submodule_sync(sm));
+       cl_git_pass(git_submodule_open(&repo, sm));
+
+       cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "relative-url"));
+
+       assert_config_entry_value(g_repo, "submodule."SM1".url", path.ptr);
+       assert_config_entry_value(repo, "remote.origin.url", path.ptr);
+
+       git_repository_free(repo);
+       git_submodule_free(sm);
+       git_buf_dispose(&path);
+}