summaryrefslogtreecommitdiff
path: root/tests/repo
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-17 17:49:32 -0400
committerEdward Thomson <ethomson@microsoft.com>2015-09-18 12:17:49 -0400
commite8ddd8d76c119903677b5d0c638c875023ae6784 (patch)
tree224ba11504a626ede5968ea13b976ebe6b408d9b /tests/repo
parentadd0378d8eb76cb7fde92bcbed3eb59ee5b8947c (diff)
downloadlibgit2-e8ddd8d76c119903677b5d0c638c875023ae6784.tar.gz
repo::reservedname: test a submodule update
Test an initial submodule update, where we are trying to checkout the submodule for the first time, and placing a file within the submodule working directory with the same name as the submodule (and consequently, the same name as the repository itself).
Diffstat (limited to 'tests/repo')
-rw-r--r--tests/repo/reservedname.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/repo/reservedname.c b/tests/repo/reservedname.c
index faea0cc2b..2a5b38239 100644
--- a/tests/repo/reservedname.c
+++ b/tests/repo/reservedname.c
@@ -106,3 +106,27 @@ void test_repo_reservedname__submodule_pointer(void)
git_repository_free(sub_repo);
#endif
}
+
+/* Like the `submodule_pointer` test (above), this ensures that we do not
+ * follow the gitlink to the submodule's repository location and treat that
+ * as a reserved name. This tests at an initial submodule update, where the
+ * submodule repo is being created.
+ */
+void test_repo_reservedname__submodule_pointer_during_create(void)
+{
+ git_repository *repo;
+ git_submodule *sm;
+ git_submodule_update_options update_options = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
+ git_buf url = GIT_BUF_INIT;
+
+ repo = setup_fixture_super();
+
+ cl_git_pass(git_buf_joinpath(&url, clar_sandbox_path(), "sub.git"));
+ cl_repo_set_string(repo, "submodule.sub.url", url.ptr);
+
+ cl_git_pass(git_submodule_lookup(&sm, repo, "sub"));
+ cl_git_pass(git_submodule_update(sm, 1, &update_options));
+
+ git_submodule_free(sm);
+ git_buf_free(&url);
+}