microsoft / microsoft/vscode-pull-request-github
Permalinks in feature branches on forks should fallback to upstream main for unmodified lines
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 2.6k
- Forks
- 796
- Ø Merge
- 1 T. 4 Std.
- Gemergte PRs (30 T.)
- 46
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die Permalink-bezogene Logik und das im Issue erwähnte Beispiel in build/filters.js zu prüfen, und ermittle anschließend die Tests, die Links zu Forks und Feature-Branches abdecken. Lege die Priorität für Upstream-Standard- oder konfigurierte Branches fest und überprüfe, dass unveränderte Zeilen Upstream-Links verwenden, während geänderte Zeilen Fork-Links beibehalten; im Issue werden kein vorhandener Test und kein Einstiegspunkt genannt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- github, typescript, vscode
- Bereich
- developer-experience, devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100