def update_working_dir(dir, name, format)
      unless @wiki.repo.bare
        if @wiki.page_file_dir && dir !~ /^#{@wiki.page_file_dir}/
          dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(@wiki.page_file_dir, dir)
        end

        path =
            if dir == ''
              @wiki.page_file_name(name, format)
            else
              ::File.join(dir, @wiki.page_file_name(name, format))
            end

        path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)

        Dir.chdir(::File.join(@wiki.repo.path, '..')) do
          if file_path_scheduled_for_deletion?(index.tree, path)
            @wiki.repo.git.rm(path, :force => true)
          else
            @wiki.repo.git.checkout(path, 'HEAD')
          end
        end
      end
    end
def update_working_dir(dir, name, format)
      unless @wiki.repo.bare
        if @wiki.page_file_dir && dir !~ /^#{@wiki.page_file_dir}/
          dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(@wiki.page_file_dir, dir)
        end

        path =
            if dir == ''
              @wiki.page_file_name(name, format)
            else
              ::File.join(dir, @wiki.page_file_name(name, format))
            end

        path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)

        Dir.chdir(::File.join(@wiki.repo.path, '..')) do
          if file_path_scheduled_for_deletion?(index.tree, path)
            @wiki.repo.git.rm(path, :force => true)
          else
            @wiki.repo.git.checkout(path, 'HEAD')
          end
        end
      end
    end
Update the given file in the repository's working directory if there
 is a working directory present.

 dir    - The String directory in which the file lives.
 name   - The String name of the page or the stripped filename
          (should be pre-canonicalized if required).
 format - The Symbol format of the page.

 Returns nothing.