microsoft / microsoft/vscode-pull-request-github

Permalinks in feature branches on forks should fallback to upstream main for unmodified lines

Đang mở
#7,983 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.

feature-request
Ngôn ngữ chính
TypeScript
Star
2.6k
Fork
796
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
46

Mô tả

Problem

Referencing prior fix in PR #1816: Permalinks generated from feature branches on forks do not fallback to upstream main, even for lines that are completely unmodified. This harms canonical link-sharing because:

  1. Links to feature branches break when the branch is deleted (common after PR merge)
  2. Recipients may not have access to fork repositories
  3. The same code exists in upstream main but the link doesn't redirect there

Current Behavior

When creating a permalink from a feature branch on a fork:

  • The link points to: fork/repo/blob/feature-branch/file.ext#L123
  • No fallback occurs even if line 123 is identical in upstream main
  • Link becomes invalid after branch deletion

Proposed Enhancement

Extend the permalink generation logic to:

  1. Check if the referenced lines exist unchanged in upstream main
  2. If unchanged, generate permalink to upstream main instead
  3. Fall back to checking other long-lived branches if not in main
  4. Only use feature branch permalink if code is actually modified

main here be substituted for any default branches, or custom list thereof user can config for reference in order of prefernce
ie main/master/release-5/release-4 whereby main is preferred, but if snippet only exists in a release branch, not main, release branch in upstream is still preferred vs fork link, since it affects ability to paste into upstream github and getting content previews.

ie. https://github.com/microsoft/vscode-pull-request-github/blob/45d42a8efb0d9ba5bbf9810dcb78ba865004f67c/build/filters.js#L14

vs

https://github.com/fork/vscode-pull-request-github/blob/45d42a8efb0d9ba5bbf9810dcb78ba865004f67c/build/filters.js#L14

Context Summary

Aspect Current State Proposed State
Fork feature branch (unchanged code) Links to fork/branch Links to upstream/main
Fork feature branch (changed code) Links to fork/branch Links to fork/branch
After branch deletion Link breaks Link still works
Accessibility Fork access required Public upstream access

Benefits

  • More resilient permalink sharing
  • Better canonical link behavior
  • Reduced broken links after PR merges
  • Improved accessibility for external collaborators

This would make permalinks more useful for documentation, issue references, and knowledge sharing.

related: https://github.com/microsoft/vscode-pull-request-github/issues/1781

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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.

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra logic liên quan đến permalink và ví dụ build/filters.js được đề cập trong issue, sau đó tìm các test bao quát các liên kết đến fork và feature branch. Xác định mức độ ưu tiên giữa các branch upstream mặc định hoặc được cấu hình, đồng thời xác minh rằng các dòng không thay đổi sử dụng liên kết upstream, trong khi các dòng đã thay đổi vẫn giữ liên kết fork; issue không nêu test hiện có hay entry point nào.

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

Đánh giá

Công nghệ
github, typescript, vscode
Lĩnh vực
developer-experience, devtools
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
30/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.