pff: utiliser git diff pour la colorisation
This commit is contained in:
parent
96449de8d6
commit
7f503ae2ab
9
pff
9
pff
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue