Fix regressions using diff with bare Git repositories.

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

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.

Summary ID
Fix regressions using diff with bare Git repositories.
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.
45f4b969be3d65ed1573bb4efe3e8ab472de47a6
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (329cf64)