"git difftool" doesn't launch DiffMerge

Support for our DiffMerge utility.

Moderator: SourceGear

Post Reply
bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

"git difftool" doesn't launch DiffMerge

Post by bibroy » Fri May 20, 2016 8:17 am

Point#1
I have followed whatever the official documentation said about configuring DiffMerge for "Git for Windows (MSysGit)" - However when I am running "git difftool", the command silently returns without anything happening.

NOTE: When I first installed and configured DiffMerge for Git, the command "git difftool" did not silently return - instead there was pop which gave an error message that DiffMerge failed to launch. Then I was troubleshooting and tried many things - suddenly I found that "git difftool" command silently returns. Hence, I am not sure why this change happened!

Point#2
I have tried both the MSI installer as well as the zip version - but nothing works in windows (however, notably things are working fine in Linux -Ubuntu) - the zipped version I used is "DiffMerge_4_2_0_697_stable_x64"

Point#3
Also for example when I run the command: git config --global difftool.diffmerge.cmd "C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"" --and then run the command "git config --global --list", I can see the following entry in ".gitconfig" file corresponding to the command:

cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe "" ""

Why are the LOCAL and REMOTE missing?

I tried to edit the .gitconfig directly by entering: cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\" in the .gitconfig file - still nothing worked.

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Fri May 20, 2016 12:22 pm

Let's start with point 2, because I'm not sure what you mean by nothing working in Windows.

Are you able to launch DiffMerge separately from Git and use it? Once we've established that, then we can look at using it with Git.
Beth Kieler
SourceGear Technical Support

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Mon May 23, 2016 2:01 am

By "nothing working in Windows", I mean the following :

STEP#1: COMMANDS I RAN
~~~~~~~~~~~~~~~~~~~
diff
-----
git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd "F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe \"$LOCAL\" \"$REMOTE\""

merge
-------
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.trustExitCode true
git config --global mergetool.diffmerge.cmd "F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe /merge /result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\""

STEP#2: HOW .gitconfig LOOKS
~~~~~~~~~~~~~~~~~~~~
user.name=Bibhash Roy
user.email=bibhash@whitepeaksoft.com
diff.tool=diffmerge
difftool.diffmerge.cmd=F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe "" ""
merge.tool=diffmerge
mergetool.diffmerge.trustexitcode=true
mergetool.diffmerge.cmd=F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe /merge /result="" "" "" ""

WHAT IS HAPPENING
~~~~~~~~~~~~~~~
STEP#3: After running the commands in step#1, I made some changes in a file called README.md (tracked) in the repo - I did not do "git add".

STEP#4: Then I ran "git diff" - as expected the inbuilt "diff" works fine!

STEP#5: Now I ran "git difftool" - I got the prompt "Launch 'diffmerge' [Y/n]" - pressed "Y" - It popped up an UI (in red cross symbol) with following error message "File () not found. File () not found."

MY QUESTIONS
~~~~~~~~~~
QUESTION#1: Why I am getting this error message and why does DiffMerge fail to launch?
QUESTION#2: Why does the following variables - "$MERGED", "$LOCAL", "$BASE", "$REMOTE"" - show up as empty string ("") in .gitconfig file? Is this the source of error?
QUESTION#3: Why are the code/commands contain line-breaks in your documentation at https://sourcegear.com/diffmerge/webhel ... ysgit.html - the line breaks are very INCONVENIENT!

I need to resolve this problem quickly! PLEASE HELP! It is urgent!

Bibhash

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Mon May 23, 2016 9:04 am

Can you tell me the version of Windows you have?

Are you using a full Git install or the portable version on a thumbdrive?

I'm assuming you're using a command-line Git client. If that's not the case, then I'll need to know the name of the client you are using.
Beth Kieler
SourceGear Technical Support

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Mon May 23, 2016 10:03 am

OS I'm using: Windows 10 (licensed - regularly updated) 64 bit
DiffMerge Version I installed for Windows: Windows zip (64bit) DiffMerge 4.2 - tried Windows Installer (64bit) also
My Git installation: Full Git Installation - 64-bit Git for Windows Setup (git version 2.8.2) as available at https://git-scm.com/download/win (non-portable)

I also attached image of the error I am getting

Bibhash
Attachments
diffmerge-error-1.png
Error I am getting when running the command "git difftool" in Windows
diffmerge-error-1.png (152.81 KiB) Viewed 24024 times

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Mon May 23, 2016 3:55 pm

Can you verify that you can run the DiffMerge tool itself? Let's make sure that works, and try to use it to diff the same files you're trying to Diff in Git.
Beth Kieler
SourceGear Technical Support

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Tue May 24, 2016 3:56 am

Yes I can run the DiffMerge executable (sgdm.exe) and I can do "diff" of same files that I was trying to use in GIT. Please, I need to resolve it quick...

Bibhash

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Tue May 24, 2016 6:23 am

DiffMerge now works on windows.....But.....read below:

Mistake I made
I installed the zipped version of DiffMerge and manually added this to PATH variable:
F:\Bibhash\Programs\DiffMerge_4_2_0_697_stable_x64\sgdm.exe
INSTEAD of this one:
F:\Bibhash\Programs\DiffMerge_4_2_0_697_stable_x64

Current Status
DiffMerge seems now works as desired BUT with a hack - read on.......

Hack
When I run the command: git config --global difftool.diffmerge.cmd "F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe \"$LOCAL\" \"$REMOTE\""
the entry in the .gitconfig looks like this:
[difftool "diffmerge"]
cmd = F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe \"\" \"\"

Note that the $LOCAL and $REMOTE is missing in the .gitconfig file - same thing happens for the related command for "merge"

Now I ran "git difftool" - this launched DiffMerge but the "diff" view was missing for the file I changed in the repository. So I did the following HACK - I modified the .gitconfig file so that the entry looks like this:
[difftool "diffmerge"]
cmd = F:/Bibhash/Programs/DiffMerge_4_2_0_697_stable_x64/sgdm.exe \"$LOCAL\" \"$REMOTE\"


Now "git difftool" command works fine and I can view the "diff" for the files I changed!!!

Questions
The hack I am using is unacceptable from my side and is only a temporary solution - I should be able to run the commands mentioned above without directly modifying the .gitconfig file. Please guide as to why the
\"$LOCAL\" \"$REMOTE\" e.t.c fails to appear in the .gitconfig file.......we are inching towards a solution...now I need your help to close this issue!!

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Tue May 24, 2016 2:52 pm

What I have currently working with Windows 10 is the following entries in the .gitconfig:

[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"

[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = true
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe /merge /result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"

Then when I run a diff, I add the switch

Code: Select all

-t=diffmerge
to indicate that I want to use DiffMerge instead of the default. I received no errors and it showed me the diff.

This is the proper way to set up according to the manual here: http://www.sourcegear.com/diffmerge/web ... ithub.html

If you had a return before the local and remote, then those wouldn't be picked up and set.
Beth Kieler
SourceGear Technical Support

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Tue May 24, 2016 6:07 pm

You said "If you had a return before the local and remote, then those wouldn't be picked up and set" - didn't quite understand what you meant by that. Do you mean "carriage return" when you say "return"? For me, the whole command is in a single line!

Note that I have NOT added the lines directly in .gitconfig (as said in the document you mentioned) - instead I ran the commands that would add the necessary lines in .gitconfig as given in the document https://sourcegear.com/diffmerge/webhel ... ysgit.html - so the question of adding a "return" does not arise.

Only reason, I feel, things are not working for me is that - $LOCAL, $REMOTE e.t.c are not getting set in .gitconfig though I am mentioning it in the command line.....

Can you tell me why this is happening?

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Tue May 24, 2016 6:44 pm

If I do not get the right solution from you today, I have to stop experimenting with DiffMerge and instead switch to a different tool like p4merge

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Wed May 25, 2016 8:38 am

I apologize for any confusion this may have caused.

It looks like one needs to escape out the $ as well. The Cygwin instructions has the $ escaped. That means you can use the instructions for either Github or cygwin. It doesn't looks to me like you're using MySysGit, which is the instructions you posted that you were using.

Your screenshot is showing me Git Bash (git-bash.exe), which comes from the same link you posted. Is that what you're using?

The instructions for MySysGit should be run for Git Cmd (git-cmd.exe). The instructions for Cygwin should be run for Git Bash (git-bash.exe)

We can update the instructions to show Git Bash and Git Cmd to avoid further confusion.
Beth Kieler
SourceGear Technical Support

bibroy
Posts: 10
Joined: Wed May 18, 2016 7:02 am

Re: "git difftool" doesn't launch DiffMerge

Post by bibroy » Wed May 25, 2016 12:10 pm

Hi Beth,

Thanks a ton! Escaping the $ did the trick! Again thanks!

My Git installation folder has both git-bash.exe and git-cmd.exe and the Git installer creates a shortcut that points to git-bash.exe - yes, so I am using git-bash.exe and msysgit (not, MySysGit - probably it was your typo)

Question#1
For what conditions or reason should I use git-cmd.exe?

Question#2
Can you give simple explanation of the variables $LOCAL, $REMOTE, $BASE, $MERGED? I got some explanation but I am very clear about them (talks about diff-pre-image e.t.c) OR you can point to me any doc that gives a lucid explanation!

Thanks!
PS: The DiffMerge documentation's confusing guidelines was the source of problem - and another thing - the documentation "code"s should not have line breaks - that's awful for users! We can't copy as it is!

Beth
Posts: 8550
Joined: Wed Jun 21, 2006 8:24 pm
Location: SourceGear
Contact:

Re: "git difftool" doesn't launch DiffMerge

Post by Beth » Wed May 25, 2016 1:54 pm

Q1: Unfortunately, I don't really know. You'll have to ask the makers of Git.

Q2: $Local is usually the file version that is in your current working area. $Remote is usually the file version that is in your source control system. $Base is the baseline or common ancestor of both files. $Merged is the result of merging $Local and $Remote.
Beth Kieler
SourceGear Technical Support

Post Reply