tomtom / quickfixsigns_vim

Mark quickfix & location list items with signs
http://www.vim.org/scripts/script.php?script_id=2584
GNU General Public License v3.0
131 stars 13 forks source link

vcsdiff: git: using -U0 causes diffs to be mis-aligned #74

Closed blueyed closed 7 years ago

blueyed commented 7 years ago

The -U0 with git-diff (to have no context lines) causes the hunk to be off / not aligned as well as without -U0 (where 3 is the default). Using -U1 already fixes this.

This typically happens when a block of text is added, where only e.g. the function name / title is adjusted: with -U0 the diff will not start at the new block, but before already.

It looks like the context is not only used for display in git-diff, but also has an impact on the detection:

git version 2.13.1.

Since using --function-context adds extra processing, I suggest to use -U1 instead of -U0.

blueyed commented 7 years ago

I've also found that additionally --diff-algorithm=patience makes the diff more useful in general.

But since this can be configured per project, or globally (git config --global diff.algorithm patience) it should not be added here probably.

blueyed commented 7 years ago

I came up with a patch for Git in the end: https://public-inbox.org/git/20170623103612.4694-1-git@thequod.de/T/#u