Fixups and improvements to git info retrieval#991
Merged
bpkroth merged 17 commits intomicrosoft:mainfrom Oct 23, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors and improves the git info retrieval logic and tests, including better handling for repositories without an upstream and updates to the returned tuple in get_git_info.
- Refactored git info functions into get_git_root, get_git_remote_info, get_git_repo_info, and updated get_git_info to return an additional absolute path value.
- Updated related tests to match the new interface and behavior.
- Adjusted tuple unpacking in base_storage to accommodate the new return value.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mlos_bench/mlos_bench/util.py | Refactored git info retrieval functions and updated get_git_info return structure. |
| mlos_bench/mlos_bench/tests/util_git_test.py | Modified and added tests to validate the updated git info retrieval behavior. |
| mlos_bench/mlos_bench/storage/base_storage.py | Updated tuple unpacking from get_git_info to capture the additional absolute path element. |
Comments suppressed due to low confidence (2)
mlos_bench/mlos_bench/storage/base_storage.py:197
- [nitpick] The variable '_future_pr' is ambiguous; consider renaming it to '_abs_path' or a similar descriptive name that indicates it holds the absolute path returned by get_git_info.
(self._git_repo, self._git_commit, self._root_env_config, _future_pr) = get_git_info(
mlos_bench/mlos_bench/util.py:401
- The return tuple description in the docstring could be clarified by explicitly separating the four elements (e.g., by inserting commas) to clearly indicate that abs_path is an additional value.
(git_repo, git_commit, rel_path, abs_path) : tuple[str, str, str, str]
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
bpkroth
commented
Jun 24, 2025
motus
approved these changes
Jul 2, 2025
Co-authored-by: Sergiy Matusevych <sergiy.matusevych@gmail.com>
motus
approved these changes
Jul 7, 2025
motus
approved these changes
Jul 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Title
Fixups and improvements to git info retrieval
Description
Various fixups and improvements to git info retrieval:
Test and handle cases where the local git repo has no upstream or the upstream is not "origin".
Prepare to also return the absolute path of the config file as well.
Type of Change
Testing
Additional Notes (optional)
To be merged before #985