Announcement

Collapse
No announcement yet.

BC4 as difftool not working for git version 2.12.0.windows.1

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • BC4 as difftool not working for git version 2.12.0.windows.1

    I tried to respond to a relevant thread about this subject but it doesn't look like I'm able to post there. I can use BC4 as a mergetool but not the difftool

    To give you all relevant information

    Downloaded and installed from https://git-scm.com/downloads
    using Git Bash exclusively, but when installed did the second option (install git for windows command line) if that matters.
    In windows 10 64 pro

    when running "git difftool file" it shows the default output of git diff (all in bash). there is no error. When running "git mergetool file" beyond compare launches as it should. Below is my setup.

    $ git --version
    git version 2.12.0.windows.1

    [merge]
    tool = bc
    [mergetool "bc"]
    path = c:/program files/beyond compare 4/bcomp.exe
    [diff]
    tool = bc
    [difftool "bc"]
    path = c:/program files/beyond compare 4/bcomp.exe


    The only other additional thing being used is git LFS.

  • Aaron
    replied
    Hello,

    Which terminal are you using to launch the command? Windows Command Prompt, Git Bash, Visual Studio Code (and if so, which sub-terminal)?
    I've retested with that version of Git and it is currently working from the Windows Command Prompt.

    Also, the gitconfig should define both the tool and the path:
    [diff]
    tool = bc
    [difftool "bc"]
    trustExitCode=true
    path = c:/Program Files/Beyond Compare 4/bcomp.exe
    [merge]
    tool = bc
    [mergetool "bc"]
    path = c:/Program Files/Beyond Compare 4/BComp.exe

    Please note the number of different entries we have for defining a difftool for different variations of Git, here:
    http://www.scootersoftware.com/support.php?zz=kb_vcs
    Git can be a little picky, and also varies depending on exactly which flavor (and version) of Git you are running.

    From BC4's perspective, you can call our application from the command line with two parameters and we'll launch the diff view. Configuring Git to call to a difftool can be tricky. One tip I have from frequent Git troubleshooting is to occasionally insert an incorrect path into the definition in order to generate an intentional error, just to verify if the current git difftool commands are pulling from the expected or a different .gitconfig file or a cached version of the file.

    Leave a comment:


  • Simon Hooper
    replied
    I'm using BC4 4.2.9 x64.

    I can confirm that the following git commands do not launch beyond compare but print the diff in the terminal.
    Code:
    git difftool
    git difftool filename.ext
    this command will launch the diff in bc

    Code:
    git difftool head filename.ext
    KUDOS @roelandsch for his post. This saved me a from a 45min headache


    *My settings*
    Code:
    $ git --version
    git version 2.21.0.windows.1
    
    $git config --list
    
    ...
    diff.tool=bc
    merge.tool=bc
    ...

    Leave a comment:


  • Aaron
    replied
    Hello,

    Installing Git for Windows with the default options does not install the necessary components to use Git from the command line. During the Git for Windows setup.exe wizard, you can select to use git bash or git from the Windows Command line. If you select command line, then both the Windows Command Line, Powershell, and VS Code's Terminal: CMD or Powershell window will then support and recognize "git". At this point, I found git difftool correctly used the .gitconfig and called/launched BC4.

    I didn't find a difference in behavior between using the Command Line and Powershell, or the Terminal in VS Code. It seemed to either work in either, or had the same setup issues in either.

    VS Code also has an option to natively support git, and the terminal can be set to be a Git Bash (which works with the default Git for Windows bash setup).

    Leave a comment:


  • ggirard07
    replied
    Same problem here. I can confirm this is related to using cmd/powershell (
    Code:
    git version 2.20.1.windows.1
    ).

    By using the instruction you provided, git difftool works in Git Bash (mingw) and WSL, but not while in a cmd or powershell session.
    This is annoying when using VS Code as default terminal is either cmd or powershell, not mingw.

    Leave a comment:


  • pdcoxhead
    replied
    POSIX to Windows path conversion

    I've been using Beyond Compare with git for ages (using MacOS) but then I hit this sort of issue when trying to integrate with the new Windows Ubuntu bash tooling. I found a problem to do with the conversion of the posix folder path to windows. Once I found a way to convert the path to Windows both of the files appeared correctly. Word of warning though, apparently you're not supposed to edit the posix files with windows applications. I did have some strange behaviour with one file disappearing from the posix fs but still visible on the windows fs.

    The script I found for converting from posix to windows paths can be found here : https://github.com/laurent22/wslpath. I did have to make one modification so that the /tmp/ files could be found by BC4. I mentioned it in issue #7. The patch I mentioned was applied to commit b9e739c654274e600dca6a2435f8a40db24036fd on my local machine.

    Leave a comment:


  • Aaron
    replied
    Hello,

    That sounds like a bug with the specific version of Git, or the .gitconfig is not properly configured for the current command line (git bash or command line) you are using.

    I would suggest running the --config command lines documented here on the same command line you are executing the "git difftool" command:
    http://www.scootersoftware.com/suppo...vcs#gitwindows

    This will help verify that the .gitconfig for the current view is configured, which should prompt for "Viewing (1/X) 'file.txt'. Launch bc [Y/n]"

    I would also suggest updating Git.

    Leave a comment:


  • roelandsch
    replied
    As pointed out on https://superuser.com/questions/5837...ommand-prompt:

    git difftool and git difftool path/to/file will always print the diff on the console
    git difftool head and git difftool head path/to/file will use Beyond compare (or whatever you configured) to show the diff.

    For whatever reason which seems to be missing from the GIT manual.

    Leave a comment:


  • Aaron
    replied
    Hello,

    Please update to BC 4.2.2. All BC 4.x updates are free for 4.x users.

    The install folder by default is either Program Files\ or Program Files (x86)\. This depends on if there was a pre-existing BC4.0 install before a 4.1 upgrade. BC4's upgrade prioritizes leaving it in the current directory, but fresh 4.1 installs are placed in the regular, 64bit Program Files\.
    The documentation notes that if the install path is different you should substitute the correct install path on your system:
    32-bit Windows users should replace "C:\Program Files (x86)" with "C:\Program Files".
    64-bit Windows users with a fresh install of BC 4.1+ should replace "C:\Program Files (x86)" with "C:\Program Files".

    I just tested with Git 2.12 and 2.13.0.windows.1, using the Git Bash, and was able to use git difftool without issue. We do see some problems crop up from time to time, as changes in Git can introduce different behavior (like, my previous comments about bc3 that used to be a requirement, before they patched and added bc).

    Leave a comment:


  • ixe013
    replied
    Hey Chris,

    I'm having the same problem as @gatsu. I am using version 4.1.1 (build 20615) 64 bit edition, and tried with Git 2.10 and 2.13.

    Like him, the explications I see on the support website don't match your test. And neither works for me. Might be that I run git from CMD, not git bash...

    I beleive you are using 64 bit BeyondCompare also. The instructions on the support website are for a 32bit edition. The binary is in a different folder...

    Will hunt for a solution some more, maybe writing a small thingy to display the parameters received and replace BComp.exe with that, just to see if it is called by Git or not...

    Leave a comment:


  • Chris
    replied
    gatsu,

    I just followed up with a phone call to your office, but you were unavailable. If you'd like to discuss your issue by phone rather than web forum or email, our phone number and office hours are listed on the contact page of our website: http://www.scootersoftware.com/index.php?zz=contact

    Leave a comment:


  • Chris
    replied
    I tested the Git for Windows instructions on our website, they are valid for git version 2.12.0.windows.1. Git for Windows version 2.12.0 supports both bc and bc3 keywords when defining diff and merge tools.

    Test environment:
    Windows 10 Pro 64
    Git for Windows 2.12.0
    Beyond Compare 4.1.9 Pro
    Git Bash Shell

    Configuration as diff and merge tool:
    Code:
    git config --global diff.tool bc3
    git config --global difftool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
    git config --global merge.tool bc3
    git config --global mergetool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
    To launch a diff from Git Bash shell:
    Code:
    git difftool file.ext
    Configuring using bc rather than bc3 also works for git 2.12.0:
    Code:
    git config --global diff.tool bc
    git config --global difftool.bc.path "c:/program files/beyond compare 4/bcomp.exe"
    git config --global merge.tool bc
    git config --global mergetool.bc.path "c:/program files/beyond compare 4/bcomp.exe"
    Our website documentation uses bc3 rather than bc because it's compatible with both newer and older versions of git.

    The merge tool definitions are in the files:
    Code:
    C:\Program Files\Git\mingw64\libexec\git-core\mergetools\bc
    C:\Program Files\Git\mingw64\libexec\git-core\mergetools\bc3
    The bc3 file just refers to the settings in the bc file, so both definitions are valid.

    If the above instructions aren't working on your system, it's possible repository local settings are overriding the global settings.

    The contents of the global git config file (c:\users\username\.gitconfig) from my working test system:
    Code:
    [diff]
            tool = bc3
    [difftool "bc3"]
            path = c:/program files/beyond compare 4/bcomp.exe
    [merge]
            tool = bc3
    [mergetool "bc3"]
            path = c:/program files/beyond compare 4/bcomp.exe
    To check your repository local git configuration, run the command "git config --list" from your repository.

    Diff related output of "git config --list" from the working repository on my test system.
    Code:
    diff.tool=bc3
    difftool.bc3.path=c:/program files/beyond compare 4/bcomp.exe

    You can also check repository specific git config by looking at the file .git/config in your repository.

    If you continue to have trouble, please email your Beyond Compare settings, your c:\users\username\.gitconfig, and your repository .git/config to support@scootersoftware.com and I'll investigate further. To save your settings to a file, open Help > Support and click the Export button.

    Chris Kennedy
    Technical Support and QA Team Lead
    Last edited by Chris; 22-Mar-2017, 01:30 PM.

    Leave a comment:


  • Chris
    replied
    I received your voicemail about the Git issue. I'm reviewing the documentation and setting up a test environment to verify the instructions, then I'll follow up with you by phone later today.

    Leave a comment:


  • gatsu
    replied
    Aaron I would advise you to take the time to read your own link: http://www.scootersoftware.com/suppo...vcs#gitwindows

    Please take careful note of the wording at the bottom of BC Version 4. If you need help with the software please ask your manager for help and then please have them contact us in this thread or by phone. There are two possibilities to what's happened here either:

    A: You're correct and the documentation you have on your site is inaccurate, but you still link people to it expecting them automatically ignore the inaccuracies or
    B: You are wrong and the documentation is correct. In that case the software has a bug.

    Leave a comment:


  • Aaron
    replied
    We offer the same support in both ways, and I did read your post. You used the keyword "bc", such as:
    [difftool "bc"]

    However, Git uses "bc3" to internally identify and use Beyond Compare 3 and Beyond Compare 4. Using "bc" might work, but then it wouldn't recognize it is calling Beyond Compare, it would call a the difftool and mergetool generically.
    Git has extra hooks to 'just make it work' by using "bc3", as documented in the link I provided. This is an internal Git behavior, and not something under our control.

    Update: Also be sure to restart. Git caches .gitconfig settings, so edits are sometimes not applied until the git process is fully restarted. If you are seeing failure after the edit, reboot your machine just to be sure the correct .gitconfig settings are being pulled in.
    Last edited by Aaron; 21-Mar-2017, 10:41 AM. Reason: Update: Reboot to avoid caching

    Leave a comment:

Working...
X