threads / discuss / 20281

External Diff Tool

Subject: External Diff Tool

## tl;dr

11 messages between Jul 29, 2009 and Aug 5, 2009.

replies: 10people: 8as markdown or json

Eric Stegemoller· Jul 29, 2009, 20:16 UTC · lore
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

Bert Wesarg· Jul 29, 2009, 20:45 UTC · re: Eric Stegemoller · lore

Re: External Diff Tool

On Wed, Jul 29, 2009 at 22:16, Eric Stegemoller<estegemoller@idmcomp.com> wrote:
> 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
Eric Stegemoller· Jul 30, 2009, 19:22 UTC · re: Bert Wesarg · lore

Re: External Diff Tool

Bert Wesarg wrote:
Show 14 quoted lines
> On Wed, Jul 29, 2009 at 22:16, Eric Stegemoller<estegemoller@idmcomp.com> wrote:
>   
>> 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
>   

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
Johannes Schindelin· Jul 31, 2009, 10:18 UTC · re: Eric Stegemoller · lore

Re: External Diff Tool

Hi,
On Thu, 30 Jul 2009, Eric Stegemoller wrote:
Show 22 quoted lines
> Bert Wesarg wrote:
> > On Wed, Jul 29, 2009 at 22:16, Eric Stegemoller<estegemoller@idmcomp.com>
> > wrote:
> >   
> > > 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
> >   
> 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

David Aguilar· Aug 1, 2009, 11:12 UTC · re: Eric Stegemoller · lore

Re: External Diff Tool

On Thu, Jul 30, 2009 at 03:22:25PM -0400, Eric Stegemoller wrote:
Show 21 quoted lines
> Bert Wesarg wrote:
>> On Wed, Jul 29, 2009 at 22:16, Eric Stegemoller<estegemoller@idmcomp.com> wrote:
>>   
>>> 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
>>   
> 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.

-- 
	David
Eric Stegemoller· Aug 4, 2009, 14:12 UTC · re: David Aguilar · lore

Re: External Diff Tool

David Aguilar wrote:
Show 42 quoted lines
> On Thu, Jul 30, 2009 at 03:22:25PM -0400, Eric Stegemoller wrote:
>   
>> Bert Wesarg wrote:
>>     
>>> On Wed, Jul 29, 2009 at 22:16, Eric Stegemoller<estegemoller@idmcomp.com> wrote:
>>>   
>>>       
>>>> 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
>>>   
>>>       
>> 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.
>
>
>   
Escaping the $'s did the trick! Thanks for everyones help.

Thanks, Eric

Dr. Lars Hanke· Aug 4, 2009, 17:02 UTC · re: Eric Stegemoller · lore

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

 >  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.
Matthieu Moy· Aug 4, 2009, 17:10 UTC · re: Dr. Lars Hanke · lore

Re: Diffing M$-Word

"Dr. Lars Hanke" <lars@lhanke.de> writes:
> 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.

-- 
Matthieu
John Tapsell· Aug 4, 2009, 17:10 UTC · re: Dr. Lars Hanke · lore

Re: Diffing M$-Word

2009/8/4 Dr. Lars Hanke <lars@lhanke.de>:
> 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
Johannes Sixt· Aug 4, 2009, 19:31 UTC · re: Dr. Lars Hanke · lore

Re: Diffing M$-Word

Dr. Lars Hanke schrieb:
> 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
Dr. Lars Hanke· Aug 5, 2009, 19:35 UTC · re: Johannes Sixt · lore

Re: Diffing M$-Word

Show 8 quoted 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.

← back to recent threads