<commit_before>desc "This is just here for the other tasks and isn't intended for your use"
task 'git:helpers' do
  def git_branch
    `git-branch`.grep(/^\*/).first.strip[(2..-1)]
  end
  def git_branches
    `git-branch`.to_a.map { |b| b[(2..-1)].chomp }
  end
  def git?
    `git-status`
    (not ($?.exitstatus == 128))
  end
  def git_stash
    `git-diff-files --quiet`
    if ($?.exitstatus == 1) then
      stash = true
      clear = (`git-stash list`.scan("\n").size == 0)
      puts("* Saving changes...")
      `git-stash save`
    else
      stash = false
    end
    begin
      yield rescue puts("* Encountered an error, backing out...")
      ensure
        if stash then
          puts("* Applying changes...")
          sh("git-stash apply")
          `git-stash clear` if clear
        end
    end
  end
  def git_fetch
    sh("git#{"-svn" if git_svn?} fetch")
  end
  def git_rebase(what = nil)
    if git_svn? then
      sh("git-rebase git-svn #{what}")
    else
      sh("git-rebase origin/master #{what}")
    end
  end
  def git_push
    git_svn? ? (sh("git-svn dcommit")) : (sh("git-push"))
  end
  def git_svn?
    `git-branch -a` =~ /^\s*git-svn/
  end
  def argv
    ARGV.inject([]) do |argv, arg|
      if (argv.last and argv.last =~ /=$/) then
        (argv.last << arg)
      else
        (argv << arg.dup)
      end
      argv
    end
  end
  def correct_env_from_argv
    argv.grep(/^[A-Z]+=/).each { |kv| ENV.send(:[]=, *kv.split("=", 2)) }
  end
  def env(name)
    case val = ENV[name]
    when "", nil then
      nil
    else
      val
    end
  end
  correct_env_from_argv
end
<commit_msg>git-svn changed it's behaviour with the lastest version, and no longer creates a git-svn branch. Modify git-svn detection to look for a [svn-remote "svn"] string in .git/config<commit_after>desc "This is just here for the other tasks and isn't intended for your use"
task 'git:helpers' do
  def git_branch
    `git-branch`.grep(/^\*/).first.strip[(2..-1)]
  end
  def git_branches
    `git-branch`.to_a.map { |b| b[(2..-1)].chomp }
  end
  def git?
    `git-status`
    (not ($?.exitstatus == 128))
  end
  def git_stash
    `git-diff-files --quiet`
    if ($?.exitstatus == 1) then
      stash = true
      clear = (`git-stash list`.scan("\n").size == 0)
      puts("* Saving changes...")
      `git-stash save`
    else
      stash = false
    end
    begin
      yield rescue puts("* Encountered an error, backing out...")
      ensure
        if stash then
          puts("* Applying changes...")
          sh("git-stash apply")
          `git-stash clear` if clear
        end
    end
  end
  def git_fetch
    sh("git#{"-svn" if git_svn?} fetch")
  end
  def git_rebase(what = nil)
    if git_svn? then
      sh("git-rebase git-svn #{what}")
    else
      sh("git-rebase origin/master #{what}")
    end
  end
  def git_push
    git_svn? ? (sh("git-svn dcommit")) : (sh("git-push"))
  end
  def git_svn?
    not File.readlines(".git/config").grep(/^\[svn-remote "svn"\]\s*$/).empty?
  end
  def argv
    ARGV.inject([]) do |argv, arg|
      if (argv.last and argv.last =~ /=$/) then
        (argv.last << arg)
      else
        (argv << arg.dup)
      end
      argv
    end
  end
  def correct_env_from_argv
    argv.grep(/^[A-Z]+=/).each { |kv| ENV.send(:[]=, *kv.split("=", 2)) }
  end
  def env(name)
    case val = ENV[name]
    when "", nil then
      nil
    else
      val
    end
  end
  correct_env_from_argv
end

{'fraction_non_alphanumeric': 0.1557163531114327, 'fraction_numerical': 0.005788712011577424, 'mean_word_length': 2.1023339317773786, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3759397', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1277, 'n_words': 348}