Skip to content

🐛 relative-paths option doesn't work for binary files #1738

@stefan-muc

Description

@stefan-muc

Add two files (one text, one binary) in the root of a git repo (/d/temp) to git cache, create a subdirectory, cd there and do a git diff --cached, you will get this output:

$ pwd
/d/temp/subdir
$ git diff --cached

added: README.md
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

─────┐
• 1: │
─────┘
Hello World

added: image.png (binary file)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Now set git config delta.relative-paths true and you will get this output:

$ git diff --cached

Δ \dev\null ⟶   ..\README.md
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

─────┐
• 1: │
─────┘
Hello World

added: image.png (binary file)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Directory structure

./image.png
./README.md
./subdir <-- cwd

\dev\null gets inserted because of #1538
..\README.md is correct
image.png is wrong, should be ..\image.png - delta uses absolute path here, but should use relative path!

Delta version 0.17.0, can reproduce on Windows 11 and Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions