<commit_before>module GitEvolution
  class Repository
    def initialize(directory_name)
      @git_repo = Rugged::Repository.discover(File.expand_path(directory_name))
    end

    def dir
      @git_repo.workdir
    end

    def line_commits(start_line, end_line, file, since = nil)
      raw_results = raw_line_history(start_line, end_line, file, since)
      raw_results.split("\u0000").map { |raw_commit| Commit.new(raw_commit) }
    end

    def raw_line_history(start_line, end_line, file, since = nil)
      since_option = "--since '#{since}'"

      Dir.chdir(dir) do
        return `git --no-pager log -z #{since_option if since} -L#{start_line},#{end_line}:#{file} --follow #{file}`
      end
    end
  end
end<commit_msg>Fix git log for when no range was specified<commit_after>module GitEvolution
  class Repository
    def initialize(directory_name)
      @git_repo = Rugged::Repository.discover(File.expand_path(directory_name))
    end

    def dir
      @git_repo.workdir
    end

    def line_commits(start_line, end_line, file, since = nil)
      raw_results = raw_line_history(start_line, end_line, file, since)
      raw_results.split("\u0000").map { |raw_commit| Commit.new(raw_commit) }
    end

    def raw_line_history(start_line, end_line, file, since = nil)
      since_option = "--since '#{since}'"

      Dir.chdir(dir) do
        return `git --no-pager log -p -z\
        #{since_option if since}\
        #{"-L#{start_line},#{end_line}:#{file}" if start_line && end_line}\
        --follow #{file}`
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12010276172125883, 'fraction_numerical': 0.005138086062941554, 'mean_word_length': 3.143617021276596, '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': '6321326', 'n_tokens_mistral': 529, 'n_tokens_neox': 523, 'n_words': 119}