dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
23.09k stars 382 forks source link

πŸ› Duplicated lines when Git detects rename out of Git repo #366

Open FranklinYu opened 4 years ago

FranklinYu commented 4 years ago

Delta:

renamed: /tmp/delta-example/dir-1/diagnostics ⟢   /tmp/delta-example/dir-2/diagnostics-2
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

renamed: tmp/delta-example/dir-1/diagnostics ⟢   tmp/delta-example/dir-2/diagnostics-2
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────┐
for cmd in "${commands[@]}"; do β”‚
β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
17
    eval "$cmd"
    echo
done

echo 'Hello!'

raw:

diff --git a/tmp/delta-example/dir-1/diagnostics b/tmp/delta-example/dir-2/diagnostics-2
similarity index 96%
rename from /tmp/delta-example/dir-1/diagnostics
rename to /tmp/delta-example/dir-2/diagnostics-2
index 0b4d47c..7c07815 100755
--- a/tmp/delta-example/dir-1/diagnostics
+++ b/tmp/delta-example/dir-2/diagnostics-2
@@ -17,3 +17,5 @@ for cmd in "${commands[@]}"; do
     eval "$cmd"
     echo
 done
+
+echo 'Hello!'

This doesn’t seem like a regression of #102 or #245; the original bug is only for Git repository, while this is comparing two non-Git directories like this:

git diff /tmp/delta-example/dir-1 /tmp/delta-example/dir-2

I noticed that it can only be reproduced when absolute paths are used, not

git diff dir-1 dir-2
dandavison commented 3 years ago

Thanks @FranklinYu! Indeed, this reproduces on passing your diff to delta on stdin.