@@ -594,6 +594,23 @@ def test_repo_odbtype(self):
594594target_type = GitCmdObjectDB
595595assert 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+
597614def test_submodules (self ):
598615assert len (self .rorepo .submodules )== 1 # non-recursive
599616assert len (list (self .rorepo .iter_submodules ()))>= 2