fix: use cwd for reported sha #398
Conversation
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
There was a problem hiding this comment.
Code Review
This pull request updates the get_git_sha utility to anchor git queries to the package's repository root instead of the current working directory, preventing incorrect SHA reporting when run from unrelated directories. It also adds comprehensive unit tests for these changes. The review feedback suggests three key improvements: safely resolving the repository root to avoid potential IndexError crashes in shallow directory structures, moving path resolution inside the try-except block to handle potential OSError exceptions, and wrapping git calls in tests to gracefully skip them if the source tree is not a git repository.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
What does this PR do?
The SHA reported in the reports was not setting the cwd correctly, which led to incorrect SHA being reported. If the source repo was different from the endpoints repo, the SHA of the source repo was being used.
Type of change
Related issues
Testing
Checklist