GitignoreParser._iter_gitignore_files: Account for ValueError in relpath

Fixes #1317
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-04-14 12:21:52 +02:00
1 parent 4e971a6176
commit ac2b2ac131
2 files changed
+7 -1

No files matched your search

+2
View File
@@ -5,6 +5,8 @@ Status of the `main` branch. Changes prior to the next official version change w
* General:
- Support environment variable `SERENA_USAGE_REPORTING` (set to `false` to disable usage reporting)
- Extended the list of always ignored directories (by language servers) with common cases.
- Fix: When scanning for `.gitignore` files, the presence of files that could not be made relative
to the project root would cause the scan to fail. #1317
JetBrains:
- Improve handling of `relative_path` parameter
+5 -1
View File
@@ -177,7 +177,11 @@ class GitignoreParser:
while queue:
next_abs_path = queue.pop(0)
if next_abs_path != self.repo_root:
rel_path = os.path.relpath(next_abs_path, self.repo_root)
try:
rel_path = os.path.relpath(next_abs_path, self.repo_root)
except ValueError:
# If the path is on a different drive (Windows) or cannot be made relative for another reason, we ignore it
continue
if self.should_ignore(rel_path):
continue
yield from scan(next_abs_path)