@@ -66,6 +66,37 @@ fn bare_repo_with_index() -> crate::Result {
6666 Ok ( ( ) )
6767}
6868
69+ #[ test]
70+ fn non_bare_turned_bare ( ) -> crate :: Result {
71+ let repo = named_subrepo_opts (
72+ "make_worktree_repo.sh" ,
73+ "non-bare-turned-bare" ,
74+ gix:: open:: Options :: isolated ( ) ,
75+ ) ?;
76+ assert ! (
77+ repo. is_bare( ) ,
78+ "the configuration dictates this, even though it looks like a main worktree"
79+ ) ;
80+ assert_eq ! ( repo. work_dir( ) , None ) ;
81+ Ok ( ( ) )
82+ }
83+
84+ #[ test]
85+ fn worktree_of_bare_repo ( ) -> crate :: Result {
86+ let repo = named_subrepo_opts (
87+ "make_worktree_repo.sh" ,
88+ "worktree-of-bare-repo" ,
89+ gix:: open:: Options :: isolated ( ) ,
90+ ) ?;
91+ assert ! ( !repo. is_bare( ) , "even though the main worktree is bare, this isn't" ) ;
92+ assert_ne ! (
93+ repo. work_dir( ) ,
94+ None ,
95+ "we have opened the repo through a worktree, which is never bare"
96+ ) ;
97+ Ok ( ( ) )
98+ }
99+
69100#[ test]
70101fn non_bare_non_git_repo_without_worktree ( ) -> crate :: Result {
71102 let repo = named_subrepo_opts (
@@ -182,12 +213,12 @@ mod missing_config_file {
182213 "worktree-no-config" ,
183214 gix:: open:: Options :: isolated ( ) ,
184215 ) ?;
185- assert ! ( repo. work_dir( ) . is_some( ) ) ;
186- assert ! ( repo. worktree( ) . is_some( ) ) ;
187216 assert ! (
188217 !repo. is_bare( ) ,
189218 "without config, we can't really know what the repo is actually but can guess as there is a worktree"
190219 ) ;
220+ assert ! ( repo. work_dir( ) . is_some( ) ) ;
221+ assert ! ( repo. worktree( ) . is_some( ) ) ;
191222 assert_eq ! (
192223 repo. config_snapshot( ) . meta( ) . source,
193224 gix:: config:: Source :: Local ,
0 commit comments