cue/load: do not load non-CUE directories as instances
Currently if we use a pattern like `./...:foo` and there's a `package
foo` file in the root directory, every single directory counts as an
instance of package foo even if it doesn't have any `package foo` files.
We fix that by only traversing to a directory's parents if there's at
least one file that might be part of the package. It's OK if that file
is excluded (a package that unifies with an ancestor directory is still
valid even if build constraints currently exclude all the files in that
directory itself).
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: If8450b8fee821af553fb2c66815ed687bc2cd359
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1230082
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>