Fix a regression with rbt patch --write/--print, plus a newline fix.

Review Request #14247 — Created Nov. 13, 2024 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

When setting up state for rbt patch, we only query local repository
information if we're going to be applying patches. If we're just
fetching a patch for display or to output to a file, we skip this step.
This then breaks due to an expectation that that state has been set.

We're now more careful about the checks and assumptions surrounding the
repository state, ensuring both cases will work.

There's also a fix for an extra newline that would appear in the patch
output. We no longer unconditionally output a newline after outputting a
patch. Instead, we only output one if the patch does not contain one.

Tested rbt patch, rbt patch --write, and rbt patch --print.

Verified the extra newline is gone.

Commits

Files