From 7f503ae2abdf4e15cac4999e1cf15220bbe116d8 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 30 Apr 2018 15:07:22 +0400 Subject: [PATCH] pff: utiliser git diff pour la colorisation --- pff | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pff b/pff index 9203ac0..d73b185 100755 --- a/pff +++ b/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 }