Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

sourcetree diff broken if diff.noPrefix or diff.srcPrefix or diff.dstPrefix used

bablex June 21, 2025

when git config contains any of diff.noPrefix, diff.srcPrefix or diff.dstPrefix (e.g. set it via "git config diff.noPrefix true" or "git config diff.srcPrefix some/path/") then diff in sourcetree is displaying incorrectly
It displays the file path below a 2nd time with a green icon and on top the first hunk is broken too

Currently sourcetree runs this command for the diff
>git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff --unified=1 -M --no-color -- some/file.js

which seems that sourcetree already is aware of a similar issue caused by diff.mnemonicprefix

The fix is simple. Instead of just using `-c diff.mnemonicprefix=false` the command has to be changed to `-c diff.mnemonicprefix=false -c diff.noPrefix=false -c diff.srcPrefix="a/" -c diff.dstPrefix="b/"`
e.g.

>git -c diff.mnemonicprefix=false -c diff.noPrefix=false -c diff.srcPrefix="a/" -c diff.dstPrefix="b/" -c core.quotepath=false --no-optional-locks diff --unified=1 -M --no-color -- some/file.js

1 answer

0 votes
bablex June 21, 2025

It's not only a view issue, but it's impossible to stage/unstage hunks in that case. The buttons are greyed out. This makes SourceTree unusable...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events