<commit_before>require 'base64'
require 'shellwords'

module Travis
  class Build
    module Scm
      class Git
        extend Assertions

        attr_reader :shell, :config

        def initialize(shell, config = {})
          @shell = shell
          @config = config
        end

        def fetch(source, target, sha, ref)
          clone(source, target)
          chdir(target)
          checkout(sha, ref)
          submodules if shell.file_exists?('.gitmodules')
          true
        end

        protected

          def clone(source, target)
            shell.export('GIT_ASKPASS', 'echo', :echo => false) # this makes git interactive auth fail
            shell.execute("git clone --depth=100 --quiet #{source} #{target}")
          ensure
            shell.execute('rm -f ~/.ssh/source_rsa', :echo => false)
          end
          assert :clone

          def chdir(target)
            shell.chdir(target)
          end

          def submodules
            shell.execute("git submodule init")
            shell.execute("git submodule update")
          end
          assert :submodules

          def checkout(sha, ref)
            shell.execute("git fetch origin +#{ref}:") if ref
            shell.execute("git checkout -qf #{sha}")
          end
          assert :checkout
      end
    end
  end
end
<commit_msg>try disabling host key checking quickly because this stalls vms like crazy<commit_after>require 'base64'
require 'shellwords'

module Travis
  class Build
    module Scm
      class Git
        extend Assertions

        attr_reader :shell, :config

        def initialize(shell, config = {})
          @shell = shell
          @config = config
        end

        def fetch(source, target, sha, ref)
          clone(source, target)
          chdir(target)
          checkout(sha, ref)
          submodules if shell.file_exists?('.gitmodules')
          true
        end

        protected

          def clone(source, target)
            shell.export('GIT_ASKPASS', 'echo', :echo => false) # this makes git interactive auth fail
            shell.execute("git clone --depth=100 --quiet #{source} #{target}")
          ensure
            shell.execute('rm -f ~/.ssh/source_rsa', :echo => false)
          end
          assert :clone

          def chdir(target)
            shell.chdir(target)
          end

          def submodules
            shell.execute('echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config', :echo => false)
            shell.execute("git submodule init")
            shell.execute("git submodule update")
          end
          assert :submodules

          def checkout(sha, ref)
            shell.execute("git fetch origin +#{ref}:") if ref
            shell.execute("git checkout -qf #{sha}")
          end
          assert :checkout
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09630931458699472, 'fraction_numerical': 0.0035149384885764497, 'mean_word_length': 1.7027540360873694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '939931', 'n_tokens_mistral': 775, 'n_tokens_neox': 746, 'n_words': 227}