<commit_before>module Grit
  
  class Git
    class GitTimeout < RuntimeError
      attr_reader :command, :bytes_read

      def initialize(command = nil, bytes_read = nil)
        @command = command
        @bytes_read = bytes_read
      end
    end

    undef_method :clone
    
    include GitRuby
    
    class << self
      attr_accessor :git_binary, :git_timeout, :git_max_size
    end
  
    self.git_binary   = "/usr/bin/env git"
    self.git_timeout  = 10
    self.git_max_size = 5242880 # 5.megabytes
    
    def self.with_timeout(timeout = 10.seconds)
      old_timeout = Grit::Git.git_timeout
      Grit::Git.git_timeout = timeout
      yield
      Grit::Git.git_timeout = old_timeout
    end
    
    attr_accessor :git_dir, :bytes_read, :work_tree
    
    def initialize(git_dir)
      self.git_dir    = git_dir
      self.work_tree  = git_dir =~ /\.git$/ ? git_dir.gsub(/\/git$/,'') : git_dir
      self.bytes_read = 0
    end
    
    def shell_escape(str)
      str.to_s.gsub("'", "\\\\'").gsub(";", '\\;')
    end
    alias_method :e, :shell_escape
    
    # Run the given git command with the specified arguments and return
    # the result as a String
    #   +cmd+ is the command
    #   +options+ is a hash of Ruby style options
    #   +args+ is the list of arguments (to be joined by spaces)
    #
    # Examples
    #   git.rev_list({:max_count => 10, :header => true}, "master")
    #
    # Returns String
    def method_missing(cmd, options = {}, *args)
      run('', cmd, '', options, args)
    end
<commit_msg>more terse and more correct<commit_after>module Grit
  
  class Git
    class GitTimeout < RuntimeError
      attr_reader :command, :bytes_read

      def initialize(command = nil, bytes_read = nil)
        @command = command
        @bytes_read = bytes_read
      end
    end

    undef_method :clone
    
    include GitRuby
    
    class << self
      attr_accessor :git_binary, :git_timeout, :git_max_size
    end
  
    self.git_binary   = "/usr/bin/env git"
    self.git_timeout  = 10
    self.git_max_size = 5242880 # 5.megabytes
    
    def self.with_timeout(timeout = 10.seconds)
      old_timeout = Grit::Git.git_timeout
      Grit::Git.git_timeout = timeout
      yield
      Grit::Git.git_timeout = old_timeout
    end
    
    attr_accessor :git_dir, :bytes_read, :work_tree
    
    def initialize(git_dir)
      self.git_dir    = git_dir
      self.work_tree  = git_dir.gsub(/\/\.git$/,'')
      self.bytes_read = 0
    end
    
    def shell_escape(str)
      str.to_s.gsub("'", "\\\\'").gsub(";", '\\;')
    end
    alias_method :e, :shell_escape
    
    # Run the given git command with the specified arguments and return
    # the result as a String
    #   +cmd+ is the command
    #   +options+ is a hash of Ruby style options
    #   +args+ is the list of arguments (to be joined by spaces)
    #
    # Examples
    #   git.rev_list({:max_count => 10, :header => true}, "master")
    #
    # Returns String
    def method_missing(cmd, options = {}, *args)
      run('', cmd, '', options, args)
    end

{'fraction_non_alphanumeric': 0.10846905537459284, 'fraction_numerical': 0.009771986970684038, 'mean_word_length': 2.270500532481363, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '755467', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1018, 'n_words': 263}