abhinav / abhinav/git-spice

restack: Detect merges

Đang mở
#314 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
area/git bug
Ngôn ngữ chính
Go
Star
763
Fork
72
Merge trung bình
18 giờ 24 phút
Pull request đã merge (30 ngày)
28

Mô tả

Report from a user:

> Starting situation is master <= A <= B.
> 1. In the Github UI, I merge in A. Locally, I `git checkout master && git pull && git checkout B`.
> 2. While on B, I perform a `gs stack restack`. A and B both restack sucessfully. Looking at `git checkout A && git log`, I can see that the A branch points to the same commit as master.
> 3. `gs stack submit` dies on the A push failing. I'm pretty sure I just tried to force push master.
> 4. `gs branch submit` dies on not finding the base branch anymore.

The thing to do here is that `restack` operations should detect when the branch in question has been merged into its base branch.
If that's the case, it should (either by default or with a prompt), delete the branch in question, and restack the upstack into the base.

Separately, RE: this line:

> I'm pretty sure I just tried to force push master.

The user shared logs and fortunately that's not true. It was a push attempt to the merged branch (A), rejected because the local ref for that branch did not match the remote ref.

---

This should not be fixed until #331 is resolved.
Fixing this would break a workaround for #331 that relies on keeping merged branches around and just not submitting them.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

The issue describes a scenario where a branch merged via GitHub UI causes problems during `gs stack restack`. The fix involves detecting merges in the restack logic, likely in the code handling branch restacking operations. Start by examining the `restack` command implementation and the branch dependency graph logic. Look for where branches are compared to their base. 'Done' means the restack command correctly identifies merged branches, optionally deletes them, and restacks children without errors.

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

Đánh giá

Công nghệ
git, go
Lĩnh vực
cli, developer-experience
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

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.