Commit 84bc2d6 tried to handle basepath values where the path contained
colons (see #877). However the fix had two (!) bugs.
- It used strridx() to find the colon separating the diffbase and the
path; it should have used stridx() because the base comes first.
- It used substring indexes incorrectly: foo[0:-1] returns the whole of
foo, not an empty string (:help exr-[:]).
Closes#878.
Do not assume the new name (`fnamer`) is the same length as the old
name (`fnamel`).
Also use the new name rather than the old name when populating the
quickfix list.
See #872.
Instead of checking whether this file exists in `diff_base` and
returning early, we let `git show` fail, which still creates an empty
`from_file` for the subsequent `git diff` to use.
This mostly reverts 2ee95686c5, but we
keep the test case.
Previously the mapping was set in the original window not the floating
window, so <Esc> in the floating window did nothing (when it should have
closed it) while <Esc> in the original window closed the floating window
(when it should have done nothing).
Fixes#868.
If fileformat is dos and eol is not set, then a '\r' (but without '\n')
will be written to the last line of temporary buffer file, which will
confuse git and make git think all lines are modified. Fix it by adding
'r' to all lines except the last one if fileformat is dos and eol is not
set.
Suggested-by: Andy Stewart <boss@airbladesoftware.com>
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
If a file is subject to a clean/smudge filter, it is impossible to stage
an individual hunk. Therefore if the user tries to stage a hunk, ask
whether they want to stage the entire instead.
Determining whether a clean/smudge filter applies is done with:
git check-attr filter -- path/to/file
– and looking for "unspecified" (not to be) in the output. The result
is cached so that for a file which is not filtered (the common case),
staging multiple hunks only incurs the cost of the external call once.
See #796.
This tells git-show to output the smudged version of a file if a
clean/smudge filter is defined for it. In turns this allows us to diff
the buffer contents (which is smudged) against the reference version.
However patches cannot be applied.
See the man pages for git-show and gitattributes for more information.
See #796, #435.
If g:gitgutter_diff_base has been set and the file being processed does
not exist in that branch/commit, ensure that every line is marked as
added - this is how git-diff behaves.
Fixes#855.