1
0
forked from VimPlug/jedi

Fix an issue with creatin a diff, fixes #1757

This commit is contained in:
Dave Halter
2022-11-13 17:51:36 +01:00
parent 26f7878d97
commit 0ba48bbb9d
2 changed files with 24 additions and 2 deletions

View File

@@ -42,11 +42,17 @@ class ChangedFile:
if self._from_path is None:
from_p = ''
else:
from_p = self._from_path.relative_to(project_path)
try:
from_p = self._from_path.relative_to(project_path)
except ValueError: # Happens it the path is not on th project_path
from_p = self._from_path
if self._to_path is None:
to_p = ''
else:
to_p = self._to_path.relative_to(project_path)
try:
to_p = self._to_path.relative_to(project_path)
except ValueError:
to_p = self._to_path
diff = difflib.unified_diff(
old_lines, new_lines,
fromfile=str(from_p),