Uh oh!
There was an error while loading. Please reload this page.
Add support for git diff --indent-heuristic option - #1652
Conversation
This test is based on example from: https://github.com/git/git/blob/433860f3d0beb0c6f205290bd16cda413148f098/t/t4061-diff-indent.sh#L17
When this flag is set, enable the GIT_DIFF_INDENT_HEURISTIC option.
When compared files don't contain spaces, the --indent-heuristic option won't make a difference.
| ContentChanges changes0 = repo.Diff.Compare(oldBlob, newBlob, noIndentHeuristicOption); | ||
| ContentChanges changes1 = repo.Diff.Compare(oldBlob, newBlob, indentHeuristicOption); | ||
| Assert.NotEqual(changes0.Patch, changes1.Patch); |
There was a problem hiding this comment.
Can we validate that changes0 is a superset of changes1?
There was a problem hiding this comment.
Or validate the results of the patch strings?
There was a problem hiding this comment.
I was wondering about what exactly to validate in this case. The main thing I wanted to validate was that the flag was making its way to indent heuristic code. By checking when we expect the flag to make a difference and when we don't expect it to make a difference, I hope that is pretty much covered.
I've added a sanity check in 2f583cb to make sure that the same lines are being added or removed. I'm trusting the algorithm to add or remove them in the correct order. 🙂
The --indent-heuristic option should create patches that add or remove the same lines, but potentially in a different order.
What this PR does
IndentHeuristicoption toCompareOptions(it's abool)--indent-heuristicmakes a difference--indent-heuristicwon't make a difference