So, I'm using git (with Git Extensions 2 on Windows) with a large VB6 codebase. For anyone who isn't familiar with VB6, it is case-insensitive and has a habit of changing the case of variable names whenever you save a file. There are steps which can be taken to minimise this behaviour (see Stop Visual Basic 6 from changing my casing), but it is unfeasible to completely eliminate the problem in this way. The problem of course is that the case changes show up as changes in Git, thus interfering with the commit history to the point where actually changes are almost impossible to find.
I'm looking for a way to handle this from the source control side and would appreciate any input. The avenues I'm currently pursuing are in order of preference are:
- Make the Git diff case insensitive - Can't seem to find a way to do this. It will also not pick up changes to strings, but that's a price I'm willing to pay for an easy fix.
- Reset hunks with only case based changes before commiting.
- Move to Visual Source Safe which has an option for case insensitive diff - No...
I've got a feeling that option number 2 is probably my best bet, but I'm not really sure of the best way to handle it. My current line of thinking is:
- Create some tool to automate Git command line
- Use the interactive prompt to iterate all changes, splitting down to the smallest hunks
- For each hunk, if the only changes are to case only, reset it
I'm pretty sure this is about as good of a solution as is possible. Running this tool before staging will solve all of the problems. Does anyone have any thoughts on this method?
Also, if i do go down this route, it would be preferable to have a Git hook to prevent any case only changes. I have absolutely no idea how to implement something like this, so any help towards creating such a script would be great.
To give some idea of the scale of the problem, when the case of a variable changes, it will change EVERY instance of every variable with the same name in open files. Every commit, this will have happened to several variables and it will appear as if ~30% of each modified file has changed. This makes a manual process (which is what I'm currently doing) quite impractical and only useful for really small commits.
Many thanks for any help!