Repository navigation
Commit c7d4e3f
fix(git): preserve whitespace in repository paths (#1210)
## 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.
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>1 parent 00bcab4 commit c7d4e3f
2 files changed
Lines changed: 44 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
0 commit comments