Sha256: 753cd00ffe4164b977230a8cd19f4273edb540805ced5409a706ea26996bfdc5

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

#!/usr/bin/env ruby

def format_commit_info timestamp, time_desc, commit_id, message, ref_name
  [
    "#{timestamp.strftime("%y %b %d")}, #{timestamp.strftime("%l:%M%p").downcase}",
    "(#{time_desc})",
    commit_id,
    message,
    ref_name
  ]
end

def render_commit_info timestamp, time_desc, commit_id, message, ref_name, merged
  [
    timestamp,
    time_desc,
    "\e[32m#{ref_name}\e[0m",
    (merged ? "  #{commit_id}" : "+ \e[33m#{commit_id}\e[0m"),
    "\e[#{message[/^Temp/] ? 31 : 90}m#{message.strip}\e[0m"
  ].join(' ')
end

commit_info = `git branch #{ARGV.join(' ')} | cut -c 3-`.strip.split("\n").reject {|ref_name|
  ref_name[' -> ']
}.map {|ref_name|
  `git log --no-walk --pretty=format:"%ct\n%cr\n%h\n%s" '#{ref_name}' --`.strip.split("\n").push(ref_name)
}.map {|commit_info|
  [Time.at(commit_info.shift.to_i)].concat(commit_info)
}.sort_by {|commit_info|
  commit_info.first # unix timestamp
}.reverse.map {|commit_info|
  format_commit_info(*commit_info)
}.transpose.map {|column|
  max_col_length = column.sort_by {|i| i.length }.last.length
  column.map {|i| i.ljust(max_col_length) }
}.transpose.map {|commit_info|
  commit_info.push(
    `git merge-base HEAD #{commit_info[2]}`.chomp[0...7] == commit_info[2]
  )
}.each {|commit_info|
  puts render_commit_info(*commit_info)
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zsh_dots-0.5.7 bin/gbrt
zsh_dots-0.5.6 bin/gbrt
zsh_dots-0.5.5 bin/gbrt
zsh_dots-0.5.4 bin/gbrt
zsh_dots-0.5.3 bin/gbrt
zsh_dots-0.5.1 bin/gbrt
zsh_dots-0.5.0 bin/gbrt