pff: utiliser git diff pour la colorisation

This commit is contained in:
Jephté Clain 2018-04-30 15:07:22 +04:00
parent 96449de8d6
commit 7f503ae2ab
1 changed files with 8 additions and 1 deletions

9
pff
View File

@ -1440,6 +1440,8 @@ function diff_cmd() {
local -a lfiles; local rfile bfile Cfile srcfile destfile
setx -a lfiles=get_local_files "$pffdir"
local -a diffcolor
isatty && diffcolor=(--color) || diffcolor=(--no-color)
for rfile in "${lfiles[@]}"; do
setx srcfile=get_pfile "$pffdir/$rfile" "$srcp" "$pffdir"
flexists "$srcfile" || continue
@ -1463,7 +1465,12 @@ function diff_cmd() {
else
[ -n "$desc" ] && echo "$desc"
desc=
diff -ur "$destfile" "$srcfile"
if [ -n "$PFF_USE_REGULAR_DIFF" ]; then
# au cas où git n'est pas disponible
diff -ur "$destfile" "$srcfile"
else
git diff "${diffcolor[@]}" --no-index "$destfile" "$srcfile"
fi
fi
done | page_maybe
}