Bug: newly added empty files still show a `-0` diff count

Aperta
#399 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Start with FileDiff#render and the output of parsePatchFiles, using either empty-file patch from the reproduction. Check how the diff count and empty diff body are rendered; the issue also notes deleted empty files as a possible counterpart. Done means the irrelevant -0 is handled and the empty-file diff display is addressed.

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

Descrizione

bug diffs
Prerequisites
Describe the issue

A very "aesthetic" "issue" that could also be a feature request, but fits better in the bug category.

Parsing works fine with empty files added in a PR, but:

  • the -0 is present despite not being relevant at all. the +0 is arguably a bit weird too, but still better than what GitHub does: showing "whitespace-only change" with no diff count.
  • no diff is shown at all. this is not a real bug as there is actually nothing to show, but having a diff header with nothing inside it looks off. maybe adding a File added with no content or similar would help?

Showcase:
diff of an empty added file

[!NOTE]
The counterpart fix(es) could maybe be applied to deleted empty files too

Reproduction

Use FileDiff#render on the output of parsePatchFiles with this data:

--- /dev/null
+++ whatever.js

OR

diff --git a/whatever.js b/whatever.js
new file mode 100644
index 000000000000..e69de29bb2d1
What browser(s) are you seeing the problem on?

Chrome

What version of @pierre/diffs are you using?

1.0.11

Lingua principale
TypeScript
Stelle
6.2k
Fork
226
Merge medio
1g 6h
PR unite (30g)
42

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 pierrecomputer/pierre

Tutte le issue di pierrecomputer/pierre

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.