From 06262014c95c79bac4bb2dcf18e31e7ece495d70 Mon Sep 17 00:00:00 2001 From: Grigory Entin <grigory.entin@gmail.com> Date: Tue, 10 Oct 2023 09:19:11 +0200 Subject: [PATCH] Fixed support for sources that are actually recompiled. --- lib/slather/coverage_info.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/slather/coverage_info.rb b/lib/slather/coverage_info.rb index 0a4d900..1c3e335 100644 --- a/lib/slather/coverage_info.rb +++ b/lib/slather/coverage_info.rb @@ -72,8 +72,11 @@ def rate_branches_tested def source_file_pathname_relative_to_repo_root test_path=source_file_pathname - if ENV["COVERAGE_PATH_EQUIVALENCE"] - test_path=Pathname("." + "#{source_file_pathname}".delete_prefix(ENV["COVERAGE_PATH_EQUIVALENCE"].delete_suffix(",."))) + equivalence=ENV["COVERAGE_PATH_EQUIVALENCE"] + if equivalence + if "#{source_file_pathname}".start_with?(equivalence) + test_path=Pathname("." + "#{source_file_pathname}".delete_prefix(equivalence.delete_suffix(",."))) + end end test_path.realpath.relative_path_from(Pathname("./").realpath) end