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
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: