DEV Community

Discussion on: How to diff Excel VBA code in SourceTree (Git client)

Collapse
 
lrn2fly profile image
lrn2fly • Edited

Hi, @fzumstein , a life-saving article. But I can't make SourceTree v3.2.6 work with that despite digging all over the forums. Console works. I'll provide all details from SourceTree and please, if you see how I can make this real for me, pls drop a message here, please...

SourceTree log for a command when I click on xlsm file is showing that GUI is calling git diff in some strange way and still treats it as a binary file:
{
"Command": "git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff --unified=3 -M --no-color -- \"Test_GitXL/Orica Contract Variation.xlsm\"", /* apparently not git diff here, I guess it is a root cause?*/
"Status": "Finished",
"CallerContext": "GetFileDiffAgainstBaseProcess",
"Output": "diff --git a/Test_GitXL/Variation.xlsm b/Test_GitXL/Variation.xlsm\nindex 0a51..1fec 100644\nBinary files a/Test_GitXL/Variation.xlsm and b/Test_GitXL/Variation.xlsm differ\n"
},

Please help me if possible, thanks!

Andrew D

Collapse
 
fzumstein profile image
Felix Zumstein

You'll need SourceTree >= 3.1.3, did you check that?

Collapse
 
lrn2fly profile image
lrn2fly

That is magic, but after you answered it started to work!

Thread Thread
 
fzumstein profile image
Felix Zumstein

I didn't know about my spiritual capabilities but glad it's working now!

Collapse
 
lrn2fly profile image
lrn2fly

Actually I believe there is still a problem in some cases: there is one command (from the logs) that is not calling Git XL and the other command is calling it and produces a proper diff output.

The command #1 that works - as it is in my SourceTree log file:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff-tree --oneline --unified=3 --root -w -M -C --ext-diff 6b4...3b7 -- \"Test_GitXL/Variation.xlsm\"

This command #2 doesn't work with Git XL:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks diff --unified=3 -M --no-color -- \"Test_GitXL/Orica Contract Variation.xlsm\"

"Output" of second command is : "diff --git a/Test_GitXL/Variation.xlsm b/Test_GitXL/Variation.xlsm\nindex 0a51..1fec 100644\nBinary files a/Test_GitXL/Variation.xlsm and b/Test_GitXL/Variation.xlsm differ\n"

Output from command #1 is meaningfull diff results as it expected to be...

Possibly I'm missing something in my Git knowledge, can't see why #1 works while #2 doesn't.... difference is that #1 has diff-tree and ext-diff... but what does that mean? "Use external diff tool"?

Andrew D