eclipse-platform / eclipse-platform/eclipse.platform
UnifiedDiff for staged files with Git
- Lingua principale
- Java
- Stelle
- 165
- Fork
- 174
- Merge medio
- 2g 8h
- PR unite (30g)
- 22
Descrizione
The UnifiedDiff compares currently against a file from the workspace. As soon as a file is staged, the comparison falls back to the old compare editor as now two Git states (index vs head) are compared.
The fallback is decided in CompareUIPlugin.prepareUnifiedDiff(...) . The unified diff needs a workspace file ( IFileEditorInput ) to overlay onto:
````
if (leftEditorInput instanceof IFileEditorInput) { // working-tree side
return new UnifiedDiffSource(..., UnifiedDiffMode.REVERT_MODE, ...);
}
if (rightEditorInput instanceof IFileEditorInput) {
return new UnifiedDiffSource(..., UnifiedDiffMode.OVERLAY_READ_ONLY_MODE, ...);
}
return null; // ← neither side is a workspace file → classic compare editor
````
• Unstaged changes (working tree vs. index/HEAD): the left side is the workspace file → unified diff works. ✅
• Staged changes (index vs. HEAD): both sides are Git revisions, neither is an IFileEditorInput → prepareUnifiedDiff returns null → classic compare. ❌
Not sure how we should handle that. Should we still compare against the workspace file? Or leave that to the old compare?
cc @tobiasmelcher
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in CompareUIPlugin.prepareUnifiedDiff(...) e segui come vengono selezionati IFileEditorInput, UnifiedDiffSource e il fallback compare editor. Confronta il percorso staged index-versus-HEAD con il percorso unstaged workspace-file, quindi determina e documenta il comportamento unified-diff previsto per i file staged. Il lavoro è completato quando il comportamento scelto è implementato e coperto dai controlli di confronto pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100