solitontech / SLL-Toolkit

Collection of LabVIEW Reusables.
MIT License
10 stars 5 forks source link

LabVIEW Code Compare Tool for Git: Identify "ghost" changes #16

Open RobustoSystems opened 2 months ago

RobustoSystems commented 2 months ago

The following is another small improvement that my colleague and I observed while using the tool earlier today.

The two branches we were comparing contained a very large number of differences (3,455 files to be exact, 3,193 of which were modified or "M"). As background, we are working on a large project, and the branches had been alive for around 2-3 weeks, which is quite long. In the future we will keep the branch lifetime shorter.

Obfuscated Screenshot 2

It turned out that the vast majority of the 3,193 modified "M" differences were in fact "ghost" changes. By "ghost" change I mean a change in the binary contents of the .vi or .ctl file, but one that is not reflected in any observable way when opening the files in the LabVIEW IDE. In other words, a "ghost" change is one where LV Compare reports 0 differences (including 0 cosmetic differences).

The screenshot below shows an example of one of the VIs modified with a "ghost" change. Please note that human inspection (by eye) of the Front Panel and Block Diagram also revealed 0 differences. In other words, the two versions of the VIs were completely identical as far as we could tell, and LV Compare agreed with this. Obfuscated Screenshot 3

I think that the large number of "ghost" changes were due to a Mass Compile or due to several Force Recompile Hierarchy (Ctrl + Shift + Click Run Arrow) that I undertook on the whole project folder on my branch. To confirm, all LabVIEW files in our project (VIs, CTLs, lvclass, lvlib) have the Separate Compiled Code setting enabled.

Feature request: It would be great if the LabVIEW Code Compare Tool for Git tool could display which changes were genuine (i.e. 1 or more differences highlighted by LV Compare), and which were "ghost". The first screenshot above prototypes this by placing the letter "G" next to each "ghost" change, in a new column.

I realise that this request may not be easy, or even possible, to implement. Implementing it may require calling a LV Compare API (which may or may not exist) to report the number of differences (0 or more) for each of the different VIs and CTLs. This could take a long time when the branches contain thousands of differences. This functionality would be useful even if implemented partially or with certain limitations (e.g. would work on sets of maximum 100 differences at a time).

Many thanks, Petru Tarabuta, Robusto Systems Ltd, Gloucestershire, UK

SatheeshvarmaSJ commented 2 months ago

Yes, Petru Tarabuta. I agree with you on this as it is really difficult to narrow down the actual code changes amongst multiple VIs that are changed simply due to re-compilation. Currently the change list is populated purely based on what Git provides as changes. So, often we see LabVIEW files in the change list that do not have actual code changes in them.

I had some ideas to filter out these files from being displayed but haven't gotten a chance to prototype it yet. I can share more details when I progress on this.

Definitely this would greatly help once it is implemented. Thanks for suggesting your idea as well on how to handle this issue in the UI.