From ac8ad37e9cec7b05f0f466ea10a2a052b9eb3d17 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Thu, 10 Oct 2013 16:18:47 +0200 Subject: Git config: pwc alias displaying also underlying changes in patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- .gitconfig | 7 +++++++ .local/bin/subwc | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 .local/bin/subwc diff --git a/.gitconfig b/.gitconfig index b14b149..51b2623 100644 --- a/.gitconfig +++ b/.gitconfig @@ -32,6 +32,13 @@ git send-email --subject-prefix=\"${subjpfx}\" \"$@\";\ }; git_se" wc = whatchanged + pwc = "!git_pwc() {\ + git wc --color \"$@\" | subwc | ${PAGER};\ + }; git_pwc" + # http://www.jukie.net/bart/blog/pimping-out-git-log + lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \ + --abbrev-commit --date=relative + [core] editor = vim diff --git a/.local/bin/subwc b/.local/bin/subwc new file mode 100755 index 0000000..7a2c851 --- /dev/null +++ b/.local/bin/subwc @@ -0,0 +1,20 @@ +#!/bin/bash + +# to be used in pipe after "git whatchanged", this adds +# info about files touched by the contained patches; +# requires patchutils package installed + +local line +while read line; do + case "${line}" in + *.patch*) + echo "${line}" + lsdiff --addprefix " " -s -- ${line##*[AMD]} 2>/dev/null \ + | sed -e 's|^\(!.*\)|\x1b\[0;34m\1\x1b\[0m|' \ + -e 's|^\(+.*\)|\x1b\[0;32m\1\x1b\[0m|' \ + -e 's|^\(-.*\)|\x1b\[0;31m\1\x1b\[0m|' + ;; + *) + echo "${line}";; + esac +done -- cgit