Closed FinnG closed 2 years ago
diff --git a/cov.el b/cov.el
index 38d4aff..2ec6f6c 100644
--- a/cov.el
+++ b/cov.el
@@ -418,9 +418,9 @@ it if necessary, or reloading if the file has changed."
(add-hook 'kill-buffer-hook 'cov-kill-buffer-hook)
;; Find file coverage.
- (let ((common (f-common-parent (list file (buffer-file-name)))))
- (cdr (assoc (string-remove-prefix common (buffer-file-name))
- (cov-data-coverage stored-data))))))))
+ (cdr (assoc (file-name-nondirectory (buffer-file-name))
+ (cov-data-coverage stored-data)))))))
(defun cov--load-coverage (coverage file &rest ignore-current)
"Load coverage data into COVERAGE from FILE.
This patch appears to fix the issue for me. I ran this through the test suite and it seems there's a failing test that appears to be unrelated to this issue (#24). I'd be happy to submit this as a pull request, but will await advice depending on the outcome of #24!
I installed cov through MELPA today; I have a repository with a structure resembling the following:
As such, I've set my
cov-coverage-file-paths
variable to the following:("../coverage" "coverage")
When I open
subdir/source_file.c
and enablecov-mode
I get an errorNo coverage data found for <repo>/subdir/source_file.c.
, despite there being a*.gcov
file available. Some cursory inspection with edebug shows that the alist in the relevantcov-data-coverage
slot has keysource_file.c
, but the lookup incov--get-buffer-coverage
is looking forsubdir/source_file.c
.This causes the key lookup to fail and
cov-set-overlays
prints the above error message.