Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Git panel shows empty diffs and Discard fails when the project is a subfolder of a repository

Chiusa
#174 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, typescript
Ambito
desktop, devtools

Direzione di ricerca

Start in src/main/panels/git.ts and trace how diff, discard, ownPath, and countLines handle paths from git status --porcelain. Check the existing tests and add coverage for a project in a repository subfolder, including tracked and untracked files. Done means diffs, discard, line counts, and commit scope work correctly for that project without including sibling-package files.

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

Descrizione

bug priority: medium severity: medium

Found in the 2026-10-07 code review and confirmed with git in a scratch repository.

Problem

git status --porcelain paths are relative to the repository root. src/main/panels/git.ts (diff, discard, ownPath, countLines) treats them as relative to the project folder. isRepo() accepts an enclosing repository, and #132 supports projects inside another repo on purpose. In repo/pkg, status lists pkg/f.txt. git diff HEAD -- :(literal)pkg/f.txt prints nothing, and git checkout HEAD -- :(literal)pkg/f.txt fails with "pathspec did not match".

Impact

In a monorepo package:

  • Selecting a file shows "No textual changes".
  • Discard fails for tracked files, and silently does nothing for untracked ones (it resolves pkg/pkg/new.txt).
  • Discard All aborts partway through.
  • Untracked files get no line counts.
  • Files from sibling packages are listed, and Commit includes them.

Fix

Run path operations with -C <toplevel> and :(top,literal) pathspecs, mapping paths through git rev-parse --show-prefix. Or limit status to the project (git status -- .). Add tests that use a project in a subfolder of a repo.

Lingua principale
TypeScript
Stelle
2
Fork
2
Merge medio
5h 28m
PR unite (30g)
24

Preparare l'ambiente

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 PierrunoYT/patch

Tutte le issue di PierrunoYT/patch

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.