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

Aperta
#7,983 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
github, typescript, vscode

Direzione di ricerca

Inizia controllando la logica relativa ai permalink e l’esempio build/filters.js menzionato nell’issue, poi individua i test che coprono i link ai fork e ai feature branch. Definisci la precedenza tra i branch upstream predefiniti o configurati e verifica che le righe non modificate utilizzino link upstream, mentre le righe modificate mantengano i link al fork; l’issue non indica alcun test esistente né alcun punto di ingresso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature-request

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

Lingua principale
TypeScript
Stelle
2.6k
Fork
796
Merge medio
1g 4h
PR unite (30g)
46

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/vscode-pull-request-github

Tutte le issue di microsoft/vscode-pull-request-github

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.