From 4063d58339e61f55ed9ef03cda89ef76c49a9dda Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 29 Aug 2019 16:31:38 -0700 Subject: [PATCH] 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. --- changelogs/fragments/ansible-test-submodules.yml | 2 ++ test/lib/ansible_test/_internal/git.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/ansible-test-submodules.yml diff --git a/changelogs/fragments/ansible-test-submodules.yml b/changelogs/fragments/ansible-test-submodules.yml new file mode 100644 index 00000000000..507fa7cfbb8 --- /dev/null +++ b/changelogs/fragments/ansible-test-submodules.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test now correctly enumerates submodules when a collection resides below the repository root diff --git a/test/lib/ansible_test/_internal/git.py b/test/lib/ansible_test/_internal/git.py index ae2388b452f..b7bb3339e93 100644 --- a/test/lib/ansible_test/_internal/git.py +++ b/test/lib/ansible_test/_internal/git.py @@ -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[^ ]+)', line).group('path') for line in output] return submodule_paths