Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Detect and prevent empty-diff PRs from being auto-marked as merged during stack submit

Đang mở
#488 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli

Hướng nghiên cứu

Tái hiện empty-diff stack trong issue, sau đó lần theo các luồng gh stack init và gh stack submit tạo hoặc gửi PRs. Xác định nơi một branch không có commit nào ngoài base của nó và định nghĩa xem command phải cảnh báo hay dừng lại. Hoàn tất khi trường hợp diff rỗng không còn bị tự động đánh dấu là merged một cách âm thầm, đồng thời có coverage cho kịch bản stack được báo cáo.

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

Mô tả

Summary

When using gh stack, it's possible to end up with a PR whose head branch has no commits beyond its base branch (i.e., an empty diff). When this happens, GitHub automatically marks that PR as "merged" as soon as it is synchronized (e.g., via gh stack submit pushing to origin), even though no actual merge was intended.

Repro scenario

Given a stack main <- branch A <- branch B:

  1. Commit to A (intending it for B).
  2. Check out B from A without making a new commit.
  3. Push B and open PRs for A and B.
  4. Run gh stack init to adopt the two branches into a stack.
  5. Run gh stack submit.

Because B's branch contains no commits beyond A, GitHub treats the PR for B as having "no diff" against its base, and the subsequent push/synchronize causes GitHub to automatically mark PR B as merged into A — even though the user never intended or triggered a merge.

Observed example

After running gh stack init followed by gh stack submit, PR #15 (branch B) was unexpectedly shown as merged into PR #14 (branch A), because branch B had no unique commits relative to branch A.

Request

gh stack should proactively detect this situation (a branch in the stack with no commits ahead of its base) and warn or prevent the user from creating/submitting a PR in that state, rather than letting it silently get auto-merged by GitHub.

Context

Reported by @jschnapper, triaged by @skarim, in a Slack thread.

Created from a Slack conversation.

Ngôn ngữ chính
Go
Star
1.5k
Fork
73
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
7

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

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

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 github/gh-stack

Tất cả issue của github/gh-stack

Issue tương tự

Thêm issue về Go

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.