From 3b3fc2a03f62e5ff69f24d86a2a0c1686d99377c Mon Sep 17 00:00:00 2001 From: William Murphy Date: Mon, 6 Nov 2023 19:02:55 -0500 Subject: [PATCH] chore: fix false positive in detecting that yardstick changed (#388) Previously, if "git diff" included the yardstick dependency declaration in one of the context/unchanged lines, configure.py would request running the quality gate on every provider. Fix this false positive by only considering lines with changes in them in the output. Signed-off-by: Will Murphy --- tests/quality/configure.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/quality/configure.py b/tests/quality/configure.py index 2aa7b577..05334ca3 100644 --- a/tests/quality/configure.py +++ b/tests/quality/configure.py @@ -338,6 +338,10 @@ def yardstick_version_changed(): # get list of files changed with git diff changes = subprocess.check_output(["git", "diff", base_ref]).decode("utf-8").splitlines() for line in changes: + if not line.strip().startswith(("-", "+")): + # this line is in the output of `git diff`, but is just context, not a change + continue + if 'git = "https://github.com/anchore/yardstick"' in line: return True