File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ gitdir: ./.real
Original file line number Diff line number Diff line change @@ -594,6 +594,23 @@ def test_repo_odbtype(self):
594594 target_type = GitCmdObjectDB
595595 assert isinstance (self .rorepo .odb , target_type )
596596
597+ @with_rw_repo ('HEAD' )
598+ def test_git_file (self , rwrepo ):
599+ # Move the .git directory to another location and create the .git file.
600+ real_path_abs = os .path .abspath (join_path_native (rwrepo .working_tree_dir , '.real' ))
601+ os .rename (rwrepo .git_dir , real_path_abs )
602+ git_file_path = join_path_native (rwrepo .working_tree_dir , '.git' )
603+ open (git_file_path , 'wb' ).write (fixture ('git_file' ))
604+
605+ # Create a repo and make sure it's pointing to the relocated .git directory.
606+ git_file_repo = Repo (rwrepo .working_tree_dir )
607+ assert os .path .abspath (git_file_repo .git_dir ) == real_path_abs
608+
609+ # Test using an absolute gitdir path in the .git file.
610+ open (git_file_path , 'wb' ).write ('gitdir: %s\n ' % real_path_abs )
611+ git_file_repo = Repo (rwrepo .working_tree_dir )
612+ assert os .path .abspath (git_file_repo .git_dir ) == real_path_abs
613+
597614 def test_submodules (self ):
598615 assert len (self .rorepo .submodules ) == 1 # non-recursive
599616 assert len (list (self .rorepo .iter_submodules ())) >= 2
You can’t perform that action at this time.
0 commit comments