Commit 11e8ee1f by Patrick Steinhardt

tests: submodule: verify setup of relative URLs

When setting up relative URLs for a submodule, then we resolve it to
the actual location and write that into ".git/config" instead of
writing the relative value. We do not yet have a test to nail down this
behaviour, which is now being added by this commit.
parent ff355778
...@@ -210,3 +210,24 @@ void test_submodule_modify__set_url(void) ...@@ -210,3 +210,24 @@ void test_submodule_modify__set_url(void)
cl_assert_equal_s(SM_LIBGIT2_URL, git_submodule_url(sm)); cl_assert_equal_s(SM_LIBGIT2_URL, git_submodule_url(sm));
git_submodule_free(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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment