[stable-2.9] 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.
(cherry picked from commit 4063d58339
)
Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
parent
c6996727ba
commit
72d93259e7
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/ansible-test-submodules.yml
Normal file
2
changelogs/fragments/ansible-test-submodules.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- ansible-test now correctly enumerates submodules when a collection resides below the repository root
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue