• 
      

    Fix JujutsuPatcher clobbering newly-added files with content.

    Review Request #14999 — Created April 2, 2026 and updated

    Information

    RBTools
    release-6.x

    Reviewers

    JujutsuPatcher.apply_patch_for_empty_files() was matching all files
    with "new file mode" in the diff, not just truly empty ones. After the
    patch command 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 (which patch can't handle) get
    created.

    • Applied a patch that added new (non empty) files.
    • Ran unit tests.
    Summary ID
    Fix JujutsuPatcher clobbering newly-added files with content.
    `JujutsuPatcher.apply_patch_for_empty_files()` was matching all files with "new file mode" in the diff, not just truly empty ones. After the `patch` command 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 (which `patch` can't handle) get created. Testing Done: - Applied a patch that added new (non empty) files. - Ran unit tests.
    zqptqvzxnpxpmywmupovuuqvusoumqws
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.