--- a/govcs.go Wed Dec 27 21:00:20 2017 -0600
+++ b/govcs.go Wed Dec 27 21:18:55 2017 -0600
@@ -39,12 +39,38 @@
// Detect will try to determine what version control system is in use in the
// given working directory and return a vcs.VCS instance for it.
func Detect(wd string) (vcs.VCS, error) {
for _, detector := range detectors {
+ // if we found one previously, check who's root is longer so that + // we return the right vcs when they're nested. + // for example if we have + // and we're testing bar, due to the order of the list we'd return + // a Git instance since it's first, but it really should be a + if len(inst.Root()) > len(instance.Root()) { return nil, ErrNoRepositoryFound