Use relative submodule status in ansible-test.

The `git submodule status` command is relative to the current git repository by default.
When running from a repository subdirectory paths can be returned above the current directory.
Specifying the current directory with `git submodule status` avoids listing submodules above that directory.

This will fix issues when testing a collection that is rooted below the repository root when that repository uses submodules.
This commit is contained in:
Matt Clay 2019-08-29 16:31:38 -07:00
parent a7fd6e99d9
commit 4063d58339
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now correctly enumerates submodules when a collection resides below the repository root

View file

@ -39,7 +39,7 @@ class Git:
def get_submodule_paths(self): # type: () -> t.List[str]
"""Return a list of submodule paths recursively."""
cmd = ['submodule', 'status', '--recursive']
cmd = ['submodule', 'status', '--recursive', '.']
output = self.run_git_split(cmd, '\n')
submodule_paths = [re.search(r'^.[0-9a-f]+ (?P<path>[^ ]+)', line).group('path') for line in output]
return submodule_paths