Skip to content

fix(git): format the base branch lookup warning correctly - #828

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
braintrustdata:mainfrom
RaphaelFakhri:fix/git-base-branch-warning
Sep 29, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
braintrustdata:mainfrom
RaphaelFakhri:fix/git-base-branch-warning

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Summary

When git remote show origin fails, _get_base_branch logs a warning with _logger.warning(f"...", e). The message has no %s specifier for the extra argument, so the logging module raises TypeError: not all arguments converted during string formatting and prints a --- Logging error --- traceback to stderr. This change formats the exception into the message.

Changes

  • Put the exception in the f-string of the warning in _get_base_branch.
  • Add a test that runs the failing lookup and checks that the warning formats and that the function falls back to main.

Testing

cd py
python -m pytest src/braintrust/test_gitutil.py

Before the change: 1 failed, 5 passed. After the change: 6 passed.

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 715d097 into braintrustdata:main Sep 29, 2026
83 checks passed
@AbhiPrasad

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants