Skip to content

fix(git): preserve whitespace in repository paths - #1210

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
braintrustdata:mainfrom
raunakpandey1:fix/git-metadata-path-whitespace
Nov 30, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
braintrustdata:mainfrom
raunakpandey1:fix/git-metadata-path-whitespace

Conversation

@raunakpandey1

@raunakpandey1 Raunak Kumar Pandey (raunakpandey1) commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1209. Eval runs can lose their commit and branch metadata when the repository directory ends in a space. Both Git discovery calls already go through a helper that removes the output newline. The additional .strip() truncated the directory name, so later Git commands ran with an invalid working directory.

Keep the discovered path intact for regular checkouts and bare repositories. The regression test creates real local Git repositories and checks the commit SHA and message through the same metadata entry point used for experiments.

Validation

  • python -m pytest -q py/src/braintrust/test_gitutil.py — on the base, both new cases failed with commit=None and the six existing tests passed. With the fix, all eight tests passed.
  • Ruff lint and format checks passed on both touched files. git diff --check passed.
  • Local environment: macOS arm64, Python 3.13.3, Git 2.35.1. The trailing-space cases are skipped on Windows. This test does not require a hosted Braintrust account.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T08:29:22.444015Z f1d5d53 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Preserves whitespace in repository paths so Git metadata remains available.

  • Git metadata lookup keeps spaces at the end of repository paths.

Reviews (2) · Last reviewed commit: "Update py/src/braintrust/test_gitutil.py" · Reviewed by Greptile

Comment thread py/src/braintrust/test_gitutil.py Resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit c7d4e3f into braintrustdata:main Nov 30, 2026
99 checks passed
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.

Git metadata is empty when a repository path ends in a space

2 participants