bin/git-diff-merge-conflict-resolution

14 lines
418 B
Ruby
Executable file

#!/usr/bin/env ruby -w
treeish = ARGV.shift || 'HEAD'
output = nil
loop do
puts "git diff-tree --color --cc #{treeish}"
output = `git diff-tree --color --cc #{treeish}`
len = output.strip.length == 40
break if !$?.success? || len == 0 || len == 40
treeish = `git log -n1 #{treeish} | head -n2 | tail -n1`.strip.split[1]
puts treeish
break unless treeish =~ /^[0-9a-f]{7}$/
end
puts output