3 # Code copied from Quilt (http://savannah.nongnu.org/projects/quilt)
5 # Copyright 2006 - the Quilt authors
7 # This script is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
13 local C
="diffhdr=1;36:diffhdradd=1;32:diffadd=32:diffhdrmod=1;35:diffmod=35:diffhdrrem=1;31:diffrem=31:diffhunk=36:diffctx=34:diffcctx=33:default=0"
14 [ -n "$DIFF_COLORS" ] && C
="$C:$DIFF_COLORS"
17 C
=col${C//:/m\'; col}m
\'
18 #coldefault=$(tput op)
25 if (/^(Index:|diff --git) /)
26 print "'$coldiffhdr'" $0 "'$coldefault'"
28 print "'$coldiffhdr'" $0 "'$coldefault'"
30 print "'$coldiffhdradd'" $0 "'$coldefault'"
32 print "'$coldiffhdrmod'" $0 "'$coldefault'"
34 print "'$coldiffhdrrem'" $0 "'$coldefault'"
35 else if (/^(\+|new( file)? mode )/)
36 print "'$coldiffadd'" $0 "'$coldefault'"
37 else if (/^(-|(deleted file|old) mode )/)
38 print "'$coldiffrem'" $0 "'$coldefault'"
40 print "'$coldiffmod'" $0 "'$coldefault'"
41 else if (/^@@ \-[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@/)
42 print gensub(/^(@@[^@]*@@)([ \t]*)(.*)/,
43 "'$coldiffhunk'" "\\1" "'$coldefault'" \
45 "'$coldiffctx'" "\\3" "'$coldefault'", "")
46 else if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/)
47 print "'$coldiffcctx'" $0 "'$coldefault'"