Skip to contentSkip to conversation

External Diff Tool

DISCUSSION Eric Stegemoller 8 participants 11 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

First off I am using Git for windows. I am trying to configure git to use an external diff tool. I am nearly there. I have it launching the correct program when "git difftool testfile.txt" is invoked. However, it appears the file paths are not being passed. I suspect I may not be using the $LOCAL and $REMOTE variables correctly. Below is how I have configured things thus far. Any help or suggestions would be greatly appreciated.

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe"
"$LOCAL" "$REMOTE""
git config --global difftool.prompt false

Thanks,
Eric

#1 lore raw
Quoted 4 lines · Eric Stegemoller

Hello,

 git config --global diff.tool TestTool
 git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe" "$LOCAL"

Try with quoting the " inside the config value:

git config --global difftool.TestTool.cmd "\"c:/TestTool/test.exe\"
\"$LOCAL\" \"$REMOTE\""

Bert

#2 lore raw
Quoted 7 lines · Bert Wesarg
Quoted 5 lines · Eric Stegemoller

Hello,

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe" "$LOCAL"

Quoted 7 lines

Try with quoting the " inside the config value:

git config --global difftool.TestTool.cmd "\"c:/TestTool/test.exe\"
\"$LOCAL\" \"$REMOTE\""

Bert

Thanks, but this did not solve it. Interestingly, I have captured the command line that is sent out by GIT and it is calling the correct program but not adding anything to the command line. So, nothing is there. Seeing this I have been experimenting around with the parameters and I still it is calling the correct program but sending a blank command line. Any suggestions on how to pursue this?

Eric

#3 lore raw
Quoted 13 lines · Eric Stegemoller
Quoted 4 lines · Bert Wesarg
Quoted 2 lines · Eric Stegemoller

Hello,

Quoted 8 lines
Quoted 2 lines

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe" "$LOCAL"

Try with quoting the " inside the config value:

git config --global difftool.TestTool.cmd "\"c:/TestTool/test.exe\"
\"$LOCAL\" \"$REMOTE\""
Bert

Quoted 8 lines

Thanks, but this did not solve it. Interestingly, I have captured the command line that is sent out by GIT and it is calling the correct program but not adding anything to the command line. So, nothing is there. Seeing this I have been experimenting around with the parameters and I still it is calling the correct program but sending a blank command line. Any suggestions on how to pursue this?

Eric

I think shell is to blame here.

Try editing ~/.gitconfig by hand.

I think the suggestion above forgot to escape the $ character.

Since the $'s weren't escaped, the shell interpolated the $LOCAL, etc. variables and replaced them with the empty string.

Signature · 1 line
	David
#4 lore raw
Quoted 27 lines · David Aguilar
Quoted 12 lines · Eric Stegemoller
Quoted 10 lines · Bert Wesarg
Quoted 5 lines · Eric Stegemoller

Hello,

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe" "$LOCAL"

Try with quoting the " inside the config value:

Quoted 9 lines
Quoted 5 lines

git config --global difftool.TestTool.cmd "\"c:/TestTool/test.exe\"
\"$LOCAL\" \"$REMOTE\""
Bert

Thanks, but this did not solve it. Interestingly, I have captured the command line that is sent out by GIT and it is calling the correct program but not adding anything to the command line. So, nothing is there. Seeing this I have been experimenting around with the parameters and I still it is calling the correct program but sending a blank command line. Any suggestions on how to pursue this?

Eric

I think shell is to blame here.

Quoted 10 lines

Try editing ~/.gitconfig by hand.

I think the suggestion above forgot to escape the $ character.

Since the $'s weren't escaped, the shell interpolated the $LOCAL, etc. variables and replaced them with the empty string.

Escaping the $'s did the trick! Thanks for everyones help.

Thanks,
Eric

#5 lore raw

Diffing M$-Word

At work I have to write a lot of reports using M$-Word and found that git is capable of managing these in an easy and meaningful way. However, diffing of course does not work. I checked the web for solutions, but somehow, I did not hit the correct search pattern.

I think it should be possible to define Word itself as the external diff tool, as described in one of today's posts

Quoted 2 lines

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd "C:/Programme/Microsoft Office/Office/Winword.exe" "\$LOCAL" "\$REMOTE" "\\mSomething"

i.e. open both versions and auto-execute a macro, which in turn will do the compare. Well, just an idea, my knowledge about the M$ and Windoze in general stuff is weak. Has this or something else been tried? Is there any howto for this around?

Probably a similar approach could be chosen for OOo - for me as a TeXnician, using git is straight forward anyhow. ;)

Regards,
- lars.

#6 lore raw

Re: Diffing M$-Word

2009/8/4 Dr. Lars Hanke <[email protected]>:

Quoted 4 lines

At work I have to write a lot of reports using M$-Word and found that git is capable of managing these in an easy and meaningful way. However, diffing of course does not work. I checked the web for solutions, but somehow, I did not hit the correct search pattern.

With the openoffice format, .odt, the file is just a zip file that you can unzip either manually or with a commit hook (and rezip with a checkout hook).

I think Microsoft's format .docx could do something similar.

That sort of diff will help git do it's job properly (e.g. you can then see when a particular image has changed etc), but not useful for a human to view.

I think a way to specify a difftool based on extension would certainly be useful. Then distros could provide default useful difftools (for comparing images, etc)

John

#7 lore raw

Re: Diffing M$-Word

In reply to Dr. Lars Hanke
Quoted 1 line · Dr. Lars Hanke

At work I have to write a lot of reports using M$-Word and found that git is capable of managing these in an easy and meaningful way. However, diffing of course does not work. I checked the web for solutions, but somehow, I did not hit the correct search pattern.

I use a dual solution. I defined catdoc as a textconv filter so that I can see textual changes in gitk; and I use my winworddiff crude hack that I posted here

http://thread.gmane.org/gmane.comp.version-control.git/59288

as a external diff program (note: *not* a difftool). With these, I can limp along sufficiently.

-- Hannes

#8 lore raw

Re: Diffing M$-Word

Quoted 5 lines
Quoted 2 lines

At work I have to write a lot of reports using M$-Word and found that git is capable of managing these in an easy and

I use a dual solution. I defined catdoc as a textconv filter so that I can see textual changes in gitk; and I use my winworddiff crude hack that I posted here
http://thread.gmane.org/gmane.comp.version-control.git/59288
as a external diff program (note: *not* a difftool). With these, I can limp along sufficiently.

That sounds good. I'll try to setup this solution at work. I actually started writing a similar thing in C# .NET, since I didn't know that you could just add a .dot to supply a macro.

Thanks,
- lars.

#9 lore raw

Re: Diffing M$-Word

In reply to Dr. Lars Hanke
Quoted 4 lines · Dr. Lars Hanke

At work I have to write a lot of reports using M$-Word and found that git is capable of managing these in an easy and meaningful way. However, diffing of course does not work. I checked the web for solutions, but somehow, I did not hit the correct search pattern.

antiword can be your friend.

See http://git.or.cz/gitwiki/GitTips#opendocument for some receipe with OpenOffice documents, they apply equally well with .doc document with antiword.

Signature · 1 line
Matthieu
#10 lore raw
In reply to Eric Stegemoller

Hi,

Quoted 16 lines · Eric Stegemoller
Quoted 9 lines · Bert Wesarg
Quoted 6 lines · Eric Stegemoller

Hello,

git config --global diff.tool TestTool
git config --global difftool.TestTool.cmd ""c:/TestTool/test.exe" "$LOCAL"

Quoted 6 lines

Try with quoting the " inside the config value:

git config --global difftool.TestTool.cmd "\"c:/TestTool/test.exe\"
\"$LOCAL\" \"$REMOTE\""
Bert

Quoted 6 lines

Thanks, but this did not solve it. Interestingly, I have captured the command line that is sent out by GIT and it is calling the correct program but not adding anything to the command line. So, nothing is there. Seeing this I have been experimenting around with the parameters and I still it is calling the correct program but sending a blank command line. Any suggestions on how to pursue this?

First thing I'd do is to call it with GIT_TRACE=1. If that does not help, I would modify the source to see what is happening.

I see that you're on Windows, and I could imagine this to be a Windows-specific problem.

Ciao,
Dscho