Fix parsing of `git diff-tree` output with copied/renamed files.

Review Request #14679 — Created Nov. 7, 2025 and updated

Information

RBTools
master

Reviewers

When a git change includes copied files and we have exclude patterns set
(either via the config file or the command-line), we were not parsing
the git diff-tree output correctly.

This change redoes the parsing to use the -z flag, which splits
records with NUL characters instead of tabs (making us more resilient
with filenames). According to the diff-tree docs, the resulting records
may include either one or two files based on the change marker. If we
have a "C" (copy) or "R" (rename) change, we use the second filename as
the test for whether we should exclude the result from the diff.
Otherwise, we parse out a single filename and test that.

A new unit test has been added which failed with the initial
implementation and succeeds with the new one.

  • Verified that diffs were properly created with the reported situation.
  • Ran unit tests.
Summary ID
Fix parsing of `git diff-tree` output with copied/renamed files.
When a git change includes copied files and we have exclude patterns set (either via the config file or the command-line), we were not parsing the `git diff-tree` output correctly. This change redoes the parsing to use the `-z` flag, which splits records with NUL characters instead of tabs (making us more resilient with filenames). According to the diff-tree docs, the resulting records may include either one or two files based on the change marker. If we have a "C" (copy) or "R" (rename) change, we use the second filename as the test for whether we should exclude the result from the diff. Otherwise, we parse out a single filename and test that. A new unit test has been added which failed with the initial implementation and succeeds with the new one. Testing Done: - Verified that diffs were properly created with the reported situation. - Ran unit tests.
pmswlyryrpqwxvwtoxorsqnpmqusxrky
Checks run (2 succeeded)
flake8 passed.
JSHint passed.