From b9864b2daf2e9d11de2e191a0300b9d906eec585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Wed, 13 Mar 2024 18:55:22 +0100 Subject: [PATCH] Debug output for `discover -h fmf --modified-only` Add `modified_ref`,`HEAD` commit hash output Print that nothing is selected --- tmt/steps/discover/fmf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tmt/steps/discover/fmf.py b/tmt/steps/discover/fmf.py index 6752f2099c..aec2ae412d 100644 --- a/tmt/steps/discover/fmf.py +++ b/tmt/steps/discover/fmf.py @@ -557,6 +557,11 @@ def assert_git_url(plan_name: Optional[str] = None) -> None: 'modified-ref', tmt.utils.default_branch(repository=self.testdir, logger=self._logger)) self.info('modified-ref', modified_ref, 'green') + ref_commit = self.run( + Command('git', 'rev-parse', '--short', str(modified_ref)), + cwd=self.testdir) + assert ref_commit.stdout is not None + self.verbose('modified-ref hash', ref_commit.stdout.strip(), 'green') output = self.run( Command( 'git', 'log', '--format=', '--stat', '--name-only', f"{modified_ref}..HEAD" @@ -566,6 +571,8 @@ def assert_git_url(plan_name: Optional[str] = None) -> None: modified = {f"^/{re.escape(name)}" for name in directories if name} self.debug(f"Limit to modified test dirs: {modified}", level=3) names.extend(modified) + else: + self.debug(f"No modified directories between '{modified_ref}..HEAD' found.") # Initialize the metadata tree, search for available tests self.debug(f"Check metadata tree in '{tree_path}'.")