From 3d10fafdfc888b43d91aebf45cb6022f4f3c3203 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 6 Jul 2015 11:46:36 -0700 Subject: configuration files --- bin/git-blame-from-line-number | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/git-blame-from-line-number (limited to 'bin/git-blame-from-line-number') diff --git a/bin/git-blame-from-line-number b/bin/git-blame-from-line-number new file mode 100755 index 0000000..dbe1970 --- /dev/null +++ b/bin/git-blame-from-line-number @@ -0,0 +1,23 @@ +#!/bin/sh + +usage() { + echo "usage: $0 " + exit 1 +} + +filename="$1" + +[ -z "${filename}" ] && usage + +lineno="$2" + +[ -z "${lineno}" ] && usage + +line=$(git blame -L "${lineno}","${lineno}" "${filename}") +sha=$(echo $line | awk '{print $1}') + +if [[ "${sha}" == "00000000" ]]; then + echo "${line}" +else + git show "${sha}" +fi -- cgit 1.4.1