From aa44d05ede5592a777c8ca097cc588efc4a7e9a0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 2 Apr 2013 18:57:02 +0200 Subject: [PATCH] add date information to git-blame --- src/rc/git-tools.kak | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rc/git-tools.kak b/src/rc/git-tools.kak index 7f244a66..1efc1775 100644 --- a/src/rc/git-tools.kak +++ b/src/rc/git-tools.kak @@ -31,10 +31,11 @@ def git-blame %{ setb git_blame_flags '' %sh{ ( declare -A authors + declare -A dates send_flags() { if [[ -z "$line" ]]; then return; fi - text="${sha:0:8} ${authors[$sha]}" - flag="$line:black:$text" + text="${sha:0:8} ${dates[$sha]} ${authors[$sha]}" + flag="$line|black|$text" for (( i=1; $i < $count; i++ )); do flag="$flag;$(($line+$i))|black|$text" done @@ -48,6 +49,8 @@ def git-blame %{ count=${BASH_REMATCH[4]} elif [[ $blame_line =~ author[^-](.*) ]]; then authors[$sha]=${BASH_REMATCH[1]} + elif [[ $blame_line =~ author-time.([0-9]*) ]]; then + dates[$sha]="$(date -d @${BASH_REMATCH[1]} +'%F %T')" fi done; send_flags ) ) >& /dev/null < /dev/null & }