#NEWLINE# @ classmethod #NEWLINE# def _write_git_file_and_module_config( cls , working_tree_dir , module_abspath ) : #NEWLINE# #INDENT# 'Writes a .git file containing a (preferably) relative path to the actual git module repository.\n        It is an error if the module_abspath cannot be made into a relative path, relative to the working_tree_dir\n        :note: will overwrite existing files !\n        :note: as we rewrite both the git file as well as the module configuration, we might fail on the configuration\n            and will not roll back changes done to the git file. This should be a non-issue, but may easily be fixed\n            if it becomes one\n        :param working_tree_dir: directory to write the .git file into\n        :param module_abspath: absolute path to the bare repository\n        ' #NEWLINE# git_file = os . path . join ( working_tree_dir , '.git' ) #NEWLINE# rela_path = os . path . relpath ( module_abspath , start = working_tree_dir ) #NEWLINE# fp = open ( git_file , 'wb' ) #NEWLINE# fp . write ( ( 'gitdir: %s' % rela_path ) . encode ( defenc ) ) #NEWLINE# fp . close ( ) #NEWLINE# writer = GitConfigParser ( os . path . join ( module_abspath , 'config' ) , read_only = False , merge_includes = False ) #NEWLINE# writer . set_value ( 'core' , 'worktree' , to_native_path_linux ( os . path . relpath ( working_tree_dir , start = module_abspath ) ) ) #NEWLINE# writer . release ( )