Fix JujutsuPatcher clobbering newly-added files with content.
Review Request #14999 — Created April 2, 2026 and updated — Latest diff uploaded
JujutsuPatcher.apply_patch_for_empty_files()was matching all files
with "new file mode" in the diff, not just truly empty ones. After the
patchcommand correctly created new files with content,
apply_patch_for_empty_files()would then overwrite them via
make_empty_files(), truncating them to zero bytes.The fix skips files that already exist on disk (created by
patch) so
that only genuinely empty files (whichpatchcan't handle) get
created.
- Applied a patch that added new (non empty) files.
- Ran unit tests.