Not all versions of grep support the --color flag. This checks the
output of grep --help when building the grep command and avoids using
flags that aren't compatible with the version present.
Fixes#234.
`git diff` doesn't perform EOL conversion on stdin, causing it to
mistakenly flag every line as having changed when the working tree uses
a different EOL than the blobs. Writing the buffer to a temporary file
and diffing against that avoids this issue.
Fixes#232.
Adds support for when a symlink file <target> points to another file
<source>, where <srouce> is a file under Git version control.
Thanks to @Z1MM32M4N for work on this (see #209).
Also don't pass buffer number to functions when they can look it up
themselves.
Using buffer numbers also eliminates any ambiguity which might arise
from symbolic links, where you have potentially two names for a file.
Thanks to @Z1MM32M4N for work on this (see #209).
The only reason the realtime diff used `diff` instead of `git-diff`
previously was that I couldn't figure out how to do it in a way that
worked on Windows as well as Unix.
Previously vim-gitgutter generated context-free patches and applied
those to the index. However when staging a hunk situated after any
deleted lines, the line numbers on the patch were out by the number
of lines deleted, and without any context git would apply the patch
to the wrong part of the file in the index.
This commit ensure patches are generated with 1 line of context,
allowing git to adjust the line numbers appropriately and apply the
patch to the right location.
More lines of context would help git more to adjust line numbers; but
the more context we have the more we group together hunks we would
like to treat separately.