Is it possible to set diff/merge-tool for a specif

2019-05-08 14:59发布

问题:

I'm just getting started on developing in LabView, it's all new to me.

And i'd like to use git extensions to handle my versioning. Since the source is in a *.vi format, I can't use the normal diff tools, the source is binary.

Fortunately, LabView comes with dedicated diff and merge tools which seems to be very helpful. And I can setup TortoiseGit to use these tools on all *.vi files. It's from this how-to:

https://www.labviewhacker.com/doku.php?id=learn:software:github:getting_started

Is there a way to do the same in Git Extensions? I much prefer git extensions over TortoiseGit.. So I'd rather not be forced to use TortoiseGit.

From what I've found, you can only specify a general diff/merge tool, not different ones for different types of files.

Any help would be appreciated, do anyone know how? :)

回答1:

If the output of the diff tool is text, you can view diffs under standard Git using a combination of .gitattributes and .git/config. I hope that Git Extensions would respect this setting.

I recommend reading the Git Attributes chapter of the Pro Git book for details on setting this up, but the idea should be something like

*.vi diff=labview

in your repository's .gitattributes file, and

[diff "labview"]
textconv = labview-diff-tool

in your .git/config.

If the diff tool does not output text, you may find the top response to this question useful, which discusses using a graphical diff tool.



回答2:

Reference: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/

  1. Right-click in any folder (that is not a git project) and select TortoiseGit –> Settings
  2. Click on Diff Viewer tab
  3. Click Advanced -> Add
    1. Extension: .vi
    2. External Program: C:\Program Files (x86)\National Instruments\Shared\LabVIEW Compare\LVCompare.exe %base %mine-nobdcosm -nobdpos
      • -nobdcosm means do not compare the appearance of block diagram objects.
      • -nobdpos means do not compare the size or position of block diagram objects.
  4. Repeat for: .ctl and .llb extensions