Commit 12d4ed4d by Jan Melcher Committed by Russell Belfer

Test git_submodule_add_setup with relative url

parent 8f4e5275
......@@ -9,6 +9,10 @@ static git_repository *g_repo = NULL;
#define SM_LIBGIT2 "sm_libgit2"
#define SM_LIBGIT2B "sm_libgit2b"
#define SM_RELATIVE_URL "../TestGitRepository"
#define SM_RELATIVE_RESOLVED_URL "https://github.com/libgit2/TestGitRepository"
#define SM_RELATIVE "TestGitRepository"
void test_submodule_modify__initialize(void)
{
g_repo = setup_fixture_submod2();
......@@ -62,6 +66,26 @@ void test_submodule_modify__add(void)
git_config_free(cfg);
}
void test_submodule_modify__add_with_relative_url(void) {
git_submodule *sm;
git_config *cfg;
const char *s;
git_repository* repo;
/* setup_fixture_submod2 does not work here because it does not set up origin configuration */
cl_git_pass(git_clone(&repo, SM_LIBGIT2_URL, "./sandbox/submodules_cloned", NULL));
cl_git_pass(
git_submodule_add_setup(&sm, repo, SM_RELATIVE_URL, SM_RELATIVE, 1)
);
cl_git_pass(git_repository_config(&cfg, repo));
cl_git_pass(
git_config_get_string(&s, cfg, "submodule." SM_RELATIVE ".url"));
cl_assert_equal_s(s, SM_RELATIVE_RESOLVED_URL);
git_config_free(cfg);
}
static int delete_one_config(const git_config_entry *entry, void *payload)
{
git_config *cfg = payload;
......
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