File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -92,3 +92,30 @@ void test_worktree_open__submodule_worktree_child(void)
9292 cleanup_fixture_worktree (& child_fixture );
9393 cleanup_fixture_worktree (& parent_fixture );
9494}
95+
96+ void test_worktree_open__open_discovered_submodule_worktree (void )
97+ {
98+ worktree_fixture parent_fixture =
99+ WORKTREE_FIXTURE_INIT ("submodules" , WORKTREE_PARENT );
100+ worktree_fixture child_fixture =
101+ WORKTREE_FIXTURE_INIT (NULL , WORKTREE_CHILD );
102+ git_buf path = GIT_BUF_INIT ;
103+ git_repository * repo ;
104+
105+ setup_fixture_worktree (& parent_fixture );
106+ cl_git_pass (p_rename (
107+ "submodules/testrepo/.gitted" ,
108+ "submodules/testrepo/.git" ));
109+ setup_fixture_worktree (& child_fixture );
110+
111+ cl_git_pass (git_repository_discover (& path ,
112+ git_repository_workdir (child_fixture .worktree ), false, NULL ));
113+ cl_git_pass (git_repository_open (& repo , path .ptr ));
114+ cl_assert_equal_s (git_repository_workdir (child_fixture .worktree ),
115+ git_repository_workdir (repo ));
116+
117+ git_buf_free (& path );
118+ git_repository_free (repo );
119+ cleanup_fixture_worktree (& child_fixture );
120+ cleanup_fixture_worktree (& parent_fixture );
121+ }
You can’t perform that action at this time.
0 commit comments