fix(file): show files added since the diffed revision as empty instead of erroring (#130)

Co-authored-by: Roman Konoval <roman@jiko.io>
This commit is contained in:
Roman Konoval
2026-06-23 09:52:02 +02:00
committed by GitHub
co-authored by Roman Konoval
parent cffc74128a
commit ca6d751de6
5 changed files with 79 additions and 13 deletions
+4 -2
View File
@@ -28,8 +28,10 @@ local function open_revision(rev, path, enc)
return
end
local lines, had_eol, ok_read, used_enc = file.get_file_content(change_id, rel_path, enc)
if not ok_read then
-- A file added since `rev` has no content there; show it as empty so it
-- diffs as fully added rather than aborting the diff.
local lines, had_eol, ok_read, used_enc, absent = file.get_file_content(change_id, rel_path, enc)
if not ok_read and not absent then
utils.notify(string.format("Could not read `%s` from `%s`", rel_path, change_id), vim.log.levels.ERROR)
return
end