Add empty file handling in JujutsuPatcher.
Review Request #14760 — Created Jan. 6, 2026 and updated — Latest diff uploaded
In my previous change that updated the patching infrastructure to add
support for patching binary files, I changed the top-level Patcher class
so it would (when supported) callapply_patch_for_empty_files. This
caused a regression with Jujutsu, where we had no implementation of
that. I didn't catch this because it was hidden behind a conditional
which was false in the case of unit tests, since we weren't
instantiating the client with a capabilities object.This change adds an implementation of that method for Jujutsu which
works similar to the SVN and Perforce implementations. Mercurial and Git
are otherwise immune because they use SCM-native patching which handles
empty files itself (hg importandgit apply, respectively).Some of the jj unit tests were incorrectly named, saying they included
empty files when they didn't. I've fixed those up, deleted a test which
did not do anything unique, and added two new tests similar to ones we
have inGitPatcherTestsfor ensuring that empty files work correctly.To be complete, I've also added the default capabilities object to the
Git, Mercurial, and Perforce tests, just to ensure that the result of
supports_empty_files()will be correct when running the tests.
Ran unit tests.