According to `:help E302`, E302 comes from Vim being unable to rename
the swap file when an open buffer's name is changed; but the error is
mostly harmless. E302 seems to occur in vim-fugitive under Windows but
not *nix.
This fix allow :Glog and :Gdiff to work on such systems; previously the
uncaught error made these operations fail or at least work strangely.
On Windows, if Vim is invoked with a working directory starting with a
lowercase drive letter (e.g. c:\<path> instead of C:\<path>), some
mappings in the blame buffer do not work correctly. For example,
hitting Enter on a line throws an exception rather than showing the
associated commit. The reason for this is that the b:git_dir variable
is not being set on the blame buffer. The reason in turn for this is
that the path to the blame buffer is being stored in s:temp_files with
an uppercase drive letter, but in the fugitive_temp augroup, '<afile>:p'
is being expanded with a lowercase drive letter, so the lookup in
s:temp_files fails. Fix this by converting paths to lowercase before
using them as keys for the s:tempfile dictionary. Because of the way
Vim generates temporary file names, this is safe even on platforms with
case-sensitive file systems.
Our doautocmd in s:ReplaceCmd already processes the modelines while the
buffer is still modifiable, so we can disable it after tha prevent
subsequent invocations.
Closes#323.
This reverts commit d6540b2588, which
caused all sorts of breakages with buffer names with brackets in them.
This was greatly exacerbated by airline.vim setting an erroneous
b:git_dir in plugin buffers based on the current working directory.
Closes#464. Closes#463. Closes#461.
There are rare situations where a user has manually specified what they
wish to use as their work-tree directory, and even rarer situations
where the user wishes the Git directory to be customized. In the case
the user has set these using environment variables, vim-fugitive takes
advantage of these settings in order to set up.
Note that git-config(1) allows setting the work-tree and Git dir in
a number of ways (see the core.worktree) setting. This change only
respects the environment variable method, not the config file method.