<commit_before>#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# AUTHOR:
# <NAME>            https://github.com/benhoskings/dot-files/blob/master/files/bin/git_cwd_info
# MODIFIED:
# <NAME>     http://peepcode.com
# <NAME>         http://twitter.com/oliv_oil

# The methods that get called more than once are memoized.

def git_repo_path
  @git_repo_path ||= `git rev-parse --git-dir 2>/dev/null`.strip
end

def in_git_repo
  !git_repo_path.empty? &&
    git_repo_path != '~' &&
    git_repo_path != "#{ENV['HOME']}/.git"
end

def git_current_branch
end

def git_parse_branch
  @git_parse_branch ||= `git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||'`.chomp
end

def git_head_commit_id
  `git rev-parse --short HEAD 2>/dev/null`.strip
end

def git_cwd_dirty
  " %{\e[90m%}✗%{\e[0m%}" unless git_repo_path == '.' || `git ls-files -m`.strip.empty?
end

def git_cwd_untracked
  " %{\e[90m%}?%{\e[0m%}" unless git_repo_path == '.' || `git ls-files --others --exclude-standard`.strip.empty?
end

def git_cwd_staged
  " %{\e[90m%}+%{\e[0m%}" unless git_repo_path == '.' || `git diff --cached 2>/dev/null`.strip.empty?
end

def rebasing_etc
  if File.exists?(File.join(git_repo_path, 'BISECT_LOG'))
    "+bisect"
  elsif File.exists?(File.join(git_repo_path, 'MERGE_HEAD'))
    "+merge"
  elsif %w[rebase rebase-apply rebase-merge ../.dotest].any? {|d| File.exists?(File.join(git_repo_path, d)) }
    "+rebase"
  end
end

if in_git_repo
  print " %{\e[90m%}#{git_parse_branch} %{\e[37m%}#{git_head_commit_id}%{\e[0m%}#{rebasing_etc}#{git_cwd_dirty}#{git_cwd_untracked}#{git_cwd_staged}"
end<commit_msg>add separators to command line prompt<commit_after>#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# AUTHOR:
# <NAME>            https://github.com/benhoskings/dot-files/blob/master/files/bin/git_cwd_info
# MODIFIED:
# <NAME>     http://peepcode.com
# <NAME>         http://twitter.com/oliv_oil

# The methods that get called more than once are memoized.

def git_repo_path
  @git_repo_path ||= `git rev-parse --git-dir 2>/dev/null`.strip
end

def in_git_repo
  !git_repo_path.empty? &&
    git_repo_path != '~' &&
    git_repo_path != "#{ENV['HOME']}/.git"
end

def git_current_branch
end

def git_parse_branch
  @git_parse_branch ||= `git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||'`.chomp
end

def git_head_commit_id
  `git rev-parse --short HEAD 2>/dev/null`.strip
end

def git_cwd_dirty
  " %{\e[90m%}✗%{\e[0m%}" unless git_repo_path == '.' || `git ls-files -m`.strip.empty?
end

def git_cwd_untracked
  " %{\e[90m%}?%{\e[0m%}" unless git_repo_path == '.' || `git ls-files --others --exclude-standard`.strip.empty?
end

def git_cwd_staged
  " %{\e[90m%}+%{\e[0m%}" unless git_repo_path == '.' || `git diff --cached 2>/dev/null`.strip.empty?
end

def rebasing_etc
  if File.exists?(File.join(git_repo_path, 'BISECT_LOG'))
    "+bisect"
  elsif File.exists?(File.join(git_repo_path, 'MERGE_HEAD'))
    "+merge"
  elsif %w[rebase rebase-apply rebase-merge ../.dotest].any? {|d| File.exists?(File.join(git_repo_path, d)) }
    "+rebase"
  end
end

def separator
  "%{\e[37m%}#{ARGV[0]} %{\e[0m%}"
end

if in_git_repo
  print "#{separator}%{\e[90m%}#{git_parse_branch} %{\e[37m%}#{git_head_commit_id}%{\e[0m%}#{rebasing_etc}#{git_cwd_dirty}#{git_cwd_untracked}#{git_cwd_staged}"
end
{'fraction_non_alphanumeric': 0.19262419993904298, 'fraction_numerical': 0.0121914050594331, 'mean_word_length': 4.072642967542504, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '6669072', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1386, 'n_words': 239}