diff mbox series

selftest/devtool: make 'git status' list all files separately

Message ID 20250914103848.2067604-1-skandigraun@gmail.com
State New
Headers show
Series selftest/devtool: make 'git status' list all files separately | expand

Commit Message

Gyorgy Sarvari Sept. 14, 2025, 10:38 a.m. UTC
By default, when running "git status", and git finds an untracked folder with some
files in it, it lists only the folder, without the file content. In case the folder
is already tracked, then the new/modified files inside the folder are displayed
separately.

Some tests rely on listing all the files separately to be able to determine the outcome
of the test. As an example, test_devtool_git_submodules creates a patch that's stored
in the meta layer. It verifies from git status that the patch is present in the layer.
However, when using the default "git status" behavior, to be able to see the file listed,
its parent folder must be tracked by git already, otherwise only the folder is listed.

The recipe that this testcase uses has carried patches for a long time - recently the
recipe was updated, and the last patch was also removed. This broke the test, because
git tracked no patch-folder anymore, and when the test couldn't find the test-patch's
name in the git status report, it failed.

To avoid this problem, add "--untracked-files=all" argument to the git status request,
which displays all untracked files, regardless of their parent folder tracking-status.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 19a205912b..a59d9e123a 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -122,7 +122,7 @@  class DevtoolTestCase(OESelftestTestCase):
 
     def _check_repo_status(self, repo_dir, expected_status):
         """Check the worktree status of a repository"""
-        result = runCmd('git status . --porcelain',
+        result = runCmd('git status . --porcelain  --untracked-files=all',
                         cwd=repo_dir)
         for line in result.output.splitlines():
             for ind, (f_status, fn_re) in enumerate(expected_status):