mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
diff kitten: resolve symlinks before passing paths to the diff tool
This commit is contained in:
@@ -36,8 +36,12 @@ def set_diff_command(opt):
|
|||||||
def run_diff(file1, file2, context=3):
|
def run_diff(file1, file2, context=3):
|
||||||
# returns: ok, is_different, patch
|
# returns: ok, is_different, patch
|
||||||
cmd = shlex.split(set_diff_command.cmd.replace('_CONTEXT_', str(context)))
|
cmd = shlex.split(set_diff_command.cmd.replace('_CONTEXT_', str(context)))
|
||||||
|
# we resolve symlinks because git diff does not follow symlinks, while diff
|
||||||
|
# does. We want consistent behavior, also for integration with git difftool
|
||||||
|
# we always want symlinks to be followed.
|
||||||
|
path1, path2 = map(os.path.realpath, (file1, file2))
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
cmd + [file1, file2],
|
cmd + [path1, path2],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.DEVNULL)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.DEVNULL)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
returncode = p.wait()
|
returncode = p.wait()
|
||||||
|
|||||||
Reference in New Issue
Block a user