gitDiffToRemote fails on an unpushed topic branch when the remote default branch contains a slash

Đang mở Phù hợp với người mới
#61,441 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, rust
Lĩnh vực
devtools

Hướng nghiên cứu

Lỗi nằm ở bộ phân giải nhánh mặc định trong codex-rs/git-utils/src/info.rs (khoảng dòng 456-477), bộ này chỉ giữ phần văn bản sau dấu gạch chéo cuối cùng của refs/remotes/origin/release/stable. Hãy bắt đầu từ đó và thay vào đó loại bỏ chính xác tiền tố refs/remotes/<remote>/. Xác nhận rằng tên nhánh được giữ nguyên. Hoàn thành khi bước tái hiện trong issue trả về SHA của origin/release/stable và một diff thêm topic.txt, đồng thời trường hợp đối chứng một thành phần vẫn vượt qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

app-server bug CLI

The app-server RPC cannot generate a patch for a local topic branch based on origin/release/stable. It returns JSON-RPC error -32600 even though the base commit is available locally. The same sequence with the default branch named stable returns the correct SHA and patch.

Environment Official Codex CLI 0.169.0, Linux x86_64, Git 2.52.0. Reproduced with two local Git repositories and no network or model calls.

Steps to reproduce

d=$(mktemp -d)
git init -q -b release/stable "$d/upstream"
echo base > "$d/upstream/base.txt"
git -C "$d/upstream" add base.txt
git -C "$d/upstream" -c user.name=Repro -c [email protected] commit -qm base
git clone -q "$d/upstream" "$d/work"
git -C "$d/work" switch -qc topic
echo change > "$d/work/topic.txt"
git -C "$d/work" add topic.txt
git -C "$d/work" -c user.name=Repro -c [email protected] commit -qm topic
git -C "$d/work" symbolic-ref refs/remotes/origin/HEAD
git -C "$d/work" diff --stat origin/release/stable

Start codex app-server --stdio. Send initialize with {"clientInfo":{"name":"repro","version":"1"},"capabilities":{}}, then the initialized notification. Call gitDiffToRemote with {"cwd":"<absolute path to work>"}.

Observed Git prints refs/remotes/origin/release/stable and a one-line insertion in topic.txt. Codex returns -32600: failed to compute git diff to remote for cwd: ….

Expected Return the SHA of origin/release/stable and a diff adding topic.txt, just as the single-component default-branch control does.

Suggested fix The Rust default-branch resolver takes everything after the final slash, turning release/stable into stable. Strip the exact refs/remotes/<remote>/ prefix to keep the full branch name. Related issue #30940 demonstrates a similar truncation in the Desktop JavaScript branch picker. This reproduction exercises the Rust RPC directly. Rust resolver

Ngôn ngữ chính
Rust
Star
135k
Fork
21.4k
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
997

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openai/codex

Tất cả issue của openai/codex

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.