For example consider:
-The cat in the hat.
+The ox in the box.
Before this change the highlights would be:
-The cat in the hat.
^^^^^^^^^^^^^^
+The ox in the box.
^^^^^^^^^^^^^
After this change the highlights are:
-The cat in the hat.
^^^ ^^^
+The ox in the box.
^^ ^^^
Another example; before:
-The quick brown fox jumped
+The (quick) brown (fox) jumped
^^^^^^^^^^^^^^^^^^^
And after:
-The quick brown fox jumped
+The (quick) brown (fox) jumped
^ ^ ^ ^
On Vims that support it, signs are placed in the "gitgutter" group with
a priority set by g:gitgutter_sign_priority.
Closes#544.
Closes#576.
Closes#627.
The previous commit switched use of writefile() to binary mode so that
we could prevent a newline being added to a completely empty buffer.
Evidently, however, binary mode has side effects (see #567) so this
commit returns to non-binary mode - with a simpler fix for completely
empty files.
Unfortunately this implementation does not work for noeol files - see
the failing test - because writefile() does not take account of
'nofixeol' (unlike :write). This is suboptimal but acceptable because
noeol files are not be encountered often.
See #567.
This prevents git-ls-files from escaping "unusual" characters in
pathnames. When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.
This commit makes git-ls-files use the -z option to output pathnames
verbatim. These pathnames also become null terminated so we have to
ensure we remove the null terminator too.
Closes#562.
The previous implementation meant the temp file paths were treated as
regular expressions, which was vulnerable to problems with backslashes
etc.
See #494.
- Hunk stage/undo/preview no longer saves the buffer.
- Hunk undo no longer makes locations go out of sync.
- Grep can be opted out of (grep output with ansi escapes is number one cause
of issues).
- Replaced g:gitgutter_grep_command with g:gitgutter_grep.
- Always runs git-diff the same way instead of in two possible ways.
- Separated detection of git tracking from diffing.
- Simplified path handling.
- Removed support for xolox shell: Windows taskbar does not flash with async
jobs.
- Removed g:gitgutter_{eager,realtime}.
- Simplified implementation generally.
Before the plugin tries to diff a file, it checks whether git is
tracking the file. If git isn't tracking the file, it stops there and
doesn't display any signs. If git is tracking the file, the plugin
remembers so next time it can skip the check.
When I introduced asynchronous diffing for NeoVim (18b78361), I made a
refactoring mistake which caused the plugin on second and subsequent
runs [to always think git is tracking a file][1].
The non-realtime diffs – the ones you get when you save a buffer –
basically run `git diff FILE`. With an untracked file git returns
nothing and exits successfully. So although the plugin erroneously
thinks git is tracking the file, it gets an error-free, empty diff back
and so removes any and all signs. Which means that the bug doesn't make
any difference.
However the realtime diffs write the buffer's contents to a temporary
file, and write the file as staged in the index to a temporary file,
then run `git diff FILE1 FILE2`. To write the staged version of the
file we use `git show :FILE > TMPFILE`.
When `FILE` isn't known to git, `git show :FILE` exits with an error.
Unless, that is, [the filename contains square brackets and you're using
git v2.5.0+][2], in which case git exits successfully with empty output.
So if you're using git v2.5.0+, and you're editing an untracked file in
a repository, and the filename contains square brackets, the plugin will
think: git is tracking the file; the realtime diff is successful; the
file in the index is empty; so every line in the the working copy must
be an addition; hence a `+` sign on every line.
[1]: 18b7836168/autoload/gitgutter/diff.vim (L119-L121)
[2]: http://comments.gmane.org/gmane.comp.version-control.git/285686Closes#325.