microsoft / microsoft/vscode-pull-request-github
Permalinks in feature branches on forks should fallback to upstream main for unmodified lines
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.6k
- 派生
- 796
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 46
描述
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:
- Links to feature branches break when the branch is deleted (common after PR merge)
- Recipients may not have access to fork repositories
- 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:
- Check if the referenced lines exist unchanged in upstream
main - If unchanged, generate permalink to upstream
maininstead - Fall back to checking other long-lived branches if not in
main - 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.
vs
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
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先检查与 permalink 相关的逻辑以及 issue 中提到的 build/filters.js 示例,然后查找涵盖 fork 和功能分支链接的测试。定义 upstream 默认分支或已配置分支的优先级,并验证未修改的行使用 upstream 链接,而修改过的行保留 fork 链接;issue 未指出任何现有测试或入口点。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- github, typescript, vscode
- 领域
- developer-experience, devtools
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 30/100