369 Commits

Author SHA1 Message Date
Eli Young
d59ac0394a Don't use --color if grep doesn't support it
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.
2015-03-04 11:22:39 +01:00
Andy Stewart
4a239a7602 Idiomatic execute. 2015-03-04 11:00:01 +01:00
Eli Young
d613f0f3b2 Remove buffer_contents function
This was only used for realtime diffs, which now write to a temporary
file.
2015-03-04 10:55:32 +01:00
Eli Young
0cb1e41b23 Use a temporary file for buffer for realtime diffs
`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.
2015-03-04 10:55:31 +01:00
Eli Young
06240f3af3 Delete temporary blob file after use 2015-03-04 10:55:31 +01:00
Andy Stewart
1fae335a65 Force grep to produce colourless output. 2015-03-03 10:52:07 +01:00
Andrea Cedraro
88c7916d2f Use system() with silent to avoid visual artifact 2014-11-30 17:54:24 +01:00
Andy Stewart
57342e33a5 Minor refactor. 2014-11-19 10:06:17 +01:00
Chris Bandy
f73df41654 Handle files with the same name as revisions.
Before this change diffing a file with the same name as a branch would
fail because git found the name ambiguous.

See #210.
2014-11-19 10:01:09 +01:00
Andy Stewart
83309ee075 Cache the fact that a file is known to git.
This allows us to avoid checking whether a file known to git is known to
git every time we run a diff.
2014-11-17 15:41:44 +01:00
Andy Stewart
a114088f22 Support symlinked files.
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).
2014-11-14 14:16:40 +01:00
Andy Stewart
dfe985a1a6 Use buffer numbers instead of buffer names.
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).
2014-11-14 12:55:40 +01:00
Andy Stewart
b0e9efa11c Make realtime diff use git-diff.
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.
2014-11-11 10:14:38 +01:00
Andy Stewart
39f0119096 Whitespace. 2014-10-17 09:24:52 +02:00
Andy Stewart
067160c86b Remove obsolete comment. 2014-10-17 09:24:47 +02:00
Andy Stewart
e5eb9e6ecf Fix staging of hunks coming after deleted lines.
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.
2014-10-16 11:50:20 +02:00
Andy Stewart
198faa119a Report updatetime option in debugging buffer. 2014-09-22 14:39:38 +02:00
Andy Stewart
83ace2014a Suppress signs when there are more than 500. 2014-07-21 16:36:16 +02:00
Andy Stewart
fed2dbad34 Move every function into gitgutter namespace.
This makes profiling much easier.
2014-06-26 11:09:29 +02:00