views:

188

answers:

4

I'm trying to get lvdiff from meta-diff suite to work with Git.

My .gitconfig looks like this:

[gui]
    recentrepo = C:/Users/Tanner/Desktop/FIRST 2010 Beta/Java/LoganRover
[user]
    name = Tanner Smith
    email = [email protected]
[merge "labview"]
    name = LabVIEW 3-Way Merge
    driver = 'C:/Program Files/National Instruments/Shared/LabVIEW Merge/LVMerge.exe' 'C:/Program Files/National Instruments/LabVIEW 8.6/LabVIEW.exe' %O %B %A %A
    recursive = binary
[diff "lvdiff"]
    #command = 'C:/Program Files/meta-diff suite/lvdiff.exe'
    external = C:/Users/Tanner/Desktop/FIRST 2010 Beta/lvdiff.sh
[core]
    autocrlf = true

lvdiff.sh looks like this:

#!/bin/sh

"C:/Program Files/meta-diff suite/lvdiff.exe" "$2" "%5" | cat

And my .gitattributes file looks like this:

#Use a cusstom driver to merge LabVIEW files
*.vi merge=labview

#Use lvdiff as the externel diff program for LabVIEW files
*.vi diff=lvdiff

But everytime I do a diff, all Git returns is:

diff --git a/Build DashBoard Data.vi b/Build DashBoard Data.vi
index fd50547..662237f 100644
Binary files a/Build DashBoard Data.vi and b/Build DeashBoard Data.vi differ

It is like it is not using it or even recognizing my changes. Any ideas?

A: 

It depends on the size and nature of your virtual instrument (VI) files written in LabVIEW

  • size: even if those files are text, but too small, they would be by default treated as binary
  • nature: if they are binary, the default diff or merge tool would not work. (hence your custom diff set by .gitattributes might not kick in, I suppose.
    .gitattributes man page assume a diff only for text files, where a patch can be generated. Maybe a textconv config option should be defined to perform a conversion of a .vi file into a textual representation.)

I had a similar problem with very small text file while trying to setup a custom merge in this SO answer.

VonC
Most of the vi files are around 10-40KB, though a few are around 5-8KB. The file in question is at least 24KB, so I don't see how that would be the problem.
Tanner
For the record, .vi files *are* binary.
Underflow
+1  A: 

I do not have LabView, but there are a few bits of your configuration that are wrong.

  1. The “external” setting under diff.lvdiff should be named “command”.
  2. The “%” in your lvdiff.sh should probably be “$”.

On my machine (not Windows, no LabView), using diff.lvdiff.command and your .gitattributes is enough to let git diff foo.vi run the external diff driver (I even used a diff driver with a space in the pathname). The mis-configuration under diff.lvdiff is why you see the “binary file” message, it is the default diff message for files that appear to be binary. You may have been thinking of diff.external, which is related to diff.foo.command, but applies to ALL texual diffs, not just to the subset of paths with a diff=foo attribute.

Chris Johnsen
A: 

Your LVDiff has a space in it's path while you don't include the path inside quotes (like you do with the LabVIEW Merge).

LVDiff does not allow duplicate filenames, perhaps Git copies the remote file to your system and does not rename the file. Try editing the lvdiff.vi to rename one of the two files (I suggest to rename the second file.

See some instruction here

Ton
A: 

I was successfull in doing a Merge with Mercurial by ommitting the reference to the actual LabVIEW path that should perform the Merge:

[merge-tools]
LVMerge.args = $base $other $local $output
LVMerge.executable = C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe
LVMerge.gui = True
LVMerge.binary = True
[merge-patterns]
**.vi = LVMerge
**.ctl = LVMerge
**.lvclass = LVMerge
**.xctl = LVMerge
**.lvlib =LVMerge

Ton

Ton