summaryrefslogtreecommitdiffstats
path: root/.local/bin/subwc
blob: 7a2c851a6a84e4dda5d0416b781fe36bb4353cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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