diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-01-06 15:41:18 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-01-06 15:41:18 +0100 |
commit | 11e8ee1ffea118926eb69633f86ca3c5a891bc57 (patch) | |
tree | d3382227646fc3916bf77af0624eb0400278fc1d | |
parent | ff3557781d9b2e9eb3acd1e3b14786e0c93b6c75 (diff) | |
download | libgit2-11e8ee1ffea118926eb69633f86ca3c5a891bc57.tar.gz |
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.
-rw-r--r-- | tests/submodule/modify.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/submodule/modify.c b/tests/submodule/modify.c index f7a089e72..654f677e6 100644 --- a/tests/submodule/modify.c +++ b/tests/submodule/modify.c @@ -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); +} |