Fix regressions using diff with bare Git repositories.

Review Request #13898 — Created May 27, 2024 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

An older cleanup of the Git path and state management broke support for
bare Git repositories. We were computing a "top-level" path for Git, and
further processing this when encountering a standard (non-bare)
repository. However, just due to a mistake, we failed to set a value for
bare repositories. This would later resut in an assertion failure.

This is a pretty simple change that sets this path in all cases. The
only case where it wouldn't set now is when we also can't compute a
.git path at all.

Nearby code has been updated to help keep type safety, ensuring we were
working off of locally-validated types for variables before buiding
paths off the .git directory, and then asserting at the end that we
had a valid top-level path.

Tested generating a diff on a bare Git repository, which previously
had failed.

Unit tests pass.

Commits

Files