Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/python-sdk/e2b/sandbox/_git/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def parse_git_status(output: str) -> GitStatus:
if is_detached or normalized_branch.startswith("HEAD"):
detached = True
elif "..." in normalized_branch:
branch, upstream_branch = normalized_branch.split("...")
branch, upstream_branch = normalized_branch.split("...", 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the status parser fix to the JS SDK

This changes the shared Python status parser, but the repo-level AGENTS.md says SDK package changes must have equivalent JS and sync/async Python updates. The Python sync/async clients both use this parser, while packages/js-sdk/src/sandbox/git/utils.ts still does normalizedBranch.split('...'), so for the new multi-ellipsis header case the JS SDK keeps returning a different upstream (v2) than Python (v2...origin/feat...v2). Please update the JS parser/test in the same change so the SDKs remain behaviorally consistent.

Useful? React with 👍 / 👎.

current_branch = branch or None
upstream = upstream_branch or None
else:
Expand Down
11 changes: 11 additions & 0 deletions packages/python-sdk/tests/test_git_parse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from e2b.sandbox._git.parse import parse_git_status


def test_parse_git_status_branch_name_with_ellipsis():
# Branch named "feat...v2" tracking "origin/feat...v2" — split("...") without maxsplit
# used to crash with ValueError: too many values to unpack (expected 2).
output = "## feat...v2...origin/feat...v2\n"
result = parse_git_status(output)
assert result.current_branch == "feat"
assert result.upstream == "v2...origin/feat...v2"
assert not result.detached