From 5afaf12a999b1c0c153c8e3620321a23b5506674 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 14 Jun 2012 15:20:25 +0200 Subject: add some new files; misc changes Signed-off-by: Florian Pritz --- gitBlameFromLineNo | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 gitBlameFromLineNo (limited to 'gitBlameFromLineNo') diff --git a/gitBlameFromLineNo b/gitBlameFromLineNo new file mode 100755 index 0000000..432e3fa --- /dev/null +++ b/gitBlameFromLineNo @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use v5.10; + +my $debug = 0; + +my $line_no = $ARGV[0]; +my $file_name = $ARGV[1]; +say "Line: $line_no | File: $file_name" if $debug; + +# Get the git blame for the line & file +my $line = `git blame -L $line_no,$line_no $file_name`; +say "Line: $line" if $debug; + +# Reduce this just to the SHA +chomp $line; +(my $sha = $line) =~ s/^(\S+).*/$1/; +say "SHA: $sha" if $debug; + +# Show the commit for that SHA +system("git show $sha"); \ No newline at end of file -- cgit v1.2.3-24-g4f1b