Archive for September, 2011

Simple git blame function to follow C/C++ functions

function git_blame_fn() {
    if [[ $# -lt 2 ]]; then
	echo "Insufficient arguments."
	echo -e "\e[1mUsage:\e[0m $FUNCNAME <fn_to_blame> [options] <src_file>"
    else
	local fn=$1
	git blame -L "/[a-zA-Z0-9_*]\+ \+${fn}/,/^}$/" ${@:2}
    fi
}
Advertisements