<commit_before>module Gitlab
  module ImportExport
    class RepoRestorer
      include Gitlab::ImportExport::CommandLineUtil

      def initialize(project:, path_to_bundle: )
        @project = project
        @path_to_bundle = path_to_bundle
      end

      def restore
        return true unless File.exists?(@path)

        FileUtils.mkdir_p(repos_path)
        FileUtils.mkdir_p(path_to_repo)

        git_unbundle(git_bin_path: Gitlab.config.git.bin_path, repo_path: path_to_repo, bundle_path: @path_to_bundle)
      end

      private

      def repos_path
        Gitlab.config.gitlab_shell.repos_path
      end

      def path_to_repo
        @project.repository.path_to_repo
      end
    end
  end
end<commit_msg>fix issue restoring repo<commit_after>module Gitlab
  module ImportExport
    class RepoRestorer
      include Gitlab::ImportExport::CommandLineUtil

      def initialize(project:, path_to_bundle:)
        @project = project
        @path_to_bundle = path_to_bundle
      end

      def restore
        return true unless File.exists?(@path_to_bundle)

        FileUtils.mkdir_p(repos_path)
        FileUtils.mkdir_p(path_to_repo)

        git_unbundle(git_bin_path: Gitlab.config.git.bin_path, repo_path: path_to_repo, bundle_path: @path_to_bundle)
      rescue
        false
      end

      private

      def repos_path
        Gitlab.config.gitlab_shell.repos_path
      end

      def path_to_repo
        @project.repository.path_to_repo
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.058784235136940546, 'fraction_numerical': 0.0, 'mean_word_length': 2.592326139088729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2481224', 'n_tokens_mistral': 485, 'n_tokens_neox': 459, 'n_words': 90}