Add Git binary file patching.

Review Request #14714 — Created Nov. 29, 2025 and submitted

Information

RBTools
master

Reviewers

This change adds support to the GitPatcher for applying binary files
as part of changes. For git, this requires that we ask git apply to
exclude those particular files while applying, because otherwise it will
error out because there's no binary file data in the patch itself. We
then use the base patcher infrastructure for iterating through the
files, but provide overrides that can register adds, moves, and deletes
with git.

  • Ran unit tests.
  • Used rbt patch with a bunch of changes that did various file
    operations on binary files.
Summary ID
Add Git binary file patching.
This change adds support to the `GitPatcher` for applying binary files as part of changes. For git, this requires that we ask `git apply` to exclude those particular files while applying, because otherwise it will error out because there's no binary file data in the patch itself. We then use the base patcher infrastructure for iterating through the files, but provide overrides that can register adds, moves, and deletes with git. Testing Done: - Ran unit tests. - Used `rbt patch` with a bunch of changes that did various file operations on binary files.
otvzyzqqpkzmkpnlkkwoyumrmozrlxol
Description From Last Updated

line too long (89 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

line too long (89 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

line too long (89 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

line too long (89 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

line too long (89 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

Let's pull patch.binary_files out into a variable.

maubinmaubin

Can we make this one line?

maubinmaubin

Do we need to escape the paths here?

maubinmaubin
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
david
maubin
  1. 
      
  2. rbtools/clients/git.py (Diff revision 3)
     
     
    Show all issues

    Let's pull patch.binary_files out into a variable.

  3. rbtools/clients/git.py (Diff revision 3)
     
     
     
    Show all issues

    Can we make this one line?

  4. rbtools/clients/git.py (Diff revision 3)
     
     
    Show all issues

    Do we need to escape the paths here?

    1. Not according to my reading of the docs. git add and git rm both handle pathspecs (to add/remove multiple files at once) but a mv operates on filenames directly.

  5. 
      
david
david
maubin
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to master (a67ebbd)