Assume a hg repo below a git repo. `git diff` on a file managed by hg, will
return a successful exit value, but no output.
So, if we got a successful exit value from multiple VCS tools, and none of them
gave any output, keep them all as potential candidates. The next time Sy is run,
only these candidates will be tested again.
If one of them returns a proper diff, set b:sy.updated_by to that VCS and prune
all other candidates.
References #235
When you have nested repos of different VCS and you edit a file from the inner
repo, more than one VCS can return a valid diff. Only one VCS should return a
non-empty diff, though.
Once a non-empty diff is found, all other VCS get disabled to reduce overhead.
References #235.
Before this change, it was possible that a buffer was disabled, when Sy was run
more than once at startup, e.g. because of `BufEnter` and `FocusGained`.
The first call would start the detection and the second call would disable the
buffer, because the first call hadn't changed the VCS type from "unknown" yet.
Since we don't switch the window anymore, we can't simply refer to b:sy as we
used to do while Sy worked only synchronously.
Now we provide the buffer number to each job and the exit handler gets a pointer
to the b:sy of that buffer and passes it to all the subsequent functions.
References #209, #210.
For each new buffer sy#repo#detect() gets run. That function invokes callbacks
for all VCS from g:signify_vcs_list.
If no callback finds a valid repo, sy#set_signs() is never called and the VCS
type of the newly registered buffer keeps its initial value: "unknown".
The next time Sy gets run in that buffer, Sy will disable itself, so that all
subsequent times it gets run it will never even attempt to get a diff.
If a buffer was added to a repo that was initialized after Sy registered that
buffer, it will remain inactive.
In those cases, :SignifyEnable will purge the cache for the current buffer and
start all over.
The <nomodeline> flag for :doautocmd was implemented in 7.3.438. Certain
LTS distros, e.g. Ubuntu 12.04, come with even older Vim versions,
though.
Silently ignore the flag in such cases.
Closes https://github.com/mhinz/vim-signify/issues/185
sy#stop() is called by the BufDelete autocmd so b: variables may not
correspond to the buffer actually being deleted. Instead, we must use
<abuf> to determine which buffer is being deleted and pass that into
sy#stop().
There are some ripple effects, causing sy#sign#remove_all_signs to also
gain a buffer number argument.
Signed-off-by: James McCoy <vega.james@gmail.com>