This allows plugins to re-instantiate the Dispatcher
(or, now, use the instance cached in `current_dispatcher`)
without knowing what plugins have been loaded by dotbot.
This fixes plugins that want to dispatch to other plugins.
Fixes#339
See https://github.com/anishathalye/dotbot/issues/282 and
https://github.com/anishathalye/dotbot/issues/315.
This patch simplifies the implementation, removing special-case handling
for the cases of zero matches and one match. Instead, any situation
where `glob: true` is specified and the path contains a glob character
(any of "?", "*", or "[") is treated as a glob case. The reason we check
both `use_glob` and `_has_glob_chars()` is to more gracefully handle the
case where the user has enabled globs by default, but most links do not
contain glob characters and should not be treated as globs.
Note that this does NOT port the following command over:
```shell
git config --global protocol.file.allow always
```
Doing so would change the git configuration of users running
the unit tests locally, and this is not an acceptable outcome.
Instead, the git configuration is modified at the CLI using
the `-c protocol.file.allow=always` argument to accomplish
the same thing without side effects.
The fix for this Git security issue [1] involved disabling the local
clone optimization when the repository contains symbolic links. The
security fix broke this particular test; this patch works around the
fix.
[1]: https://github.com/git/git/security/advisories/GHSA-3wp6-j8xr-qw85
This change allows the test framework to reliably specify
which plugins to load and use within the same process.
Previously, plugins were loaded by importing files and then
accessing the Plugin class' list of subclasses.
Now, it's possible to run dotbot multiple times without
plugins accruing across runs with different configurations
and CLI arguments.
In addition, this fixes some circular imports that were
previously avoided because plugins were imported in a function.