From 42d5eec7d267acb442b2e6ffb87ac85e840fb94a Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 11 Jun 2015 13:16:46 -0700 Subject: [PATCH] vastly improve git-diff-merge-conflict-resolution --- git-diff-merge-conflict-resolution | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/git-diff-merge-conflict-resolution b/git-diff-merge-conflict-resolution index 7e47103..edaa548 100755 --- a/git-diff-merge-conflict-resolution +++ b/git-diff-merge-conflict-resolution @@ -1,3 +1,14 @@ -#!/bin/sh +#!/usr/bin/env ruby -w -git diff-tree --color --cc $1 | less +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