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

browse: `.gstack/.gitignore` (`*`) overrides a project's `!.gstack/pregate.json` re-include

Aperta Adatta ai principianti
#3,584 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
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, typescript
Ambito
tooling

Direzione di ricerca

Inizia in browse/src/config.ts, in corrispondenza di ensureStateDir() (intorno alla riga 142), e segui il modo in cui scrive .gstack/.gitignore. Controlla le regole di esclusione del progetto con la riproduzione fornita di git check-ignore, inclusi i file pin tracciati .gstack/pregate.json e .gstack/generated.json. Il lavoro è completato quando il file di esclusione annidato non impedisce più di aggiungere questi file; verificalo con git check-ignore e git add nella riproduzione.

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

Descrizione

What happens

ensureStateDir() in browse/src/config.ts writes .gstack/.gitignore containing * on every start (config.ts:142). Git reads a nested .gitignore after the parent one, so this * overrides a project's re-include such as:

.gstack/*
!.gstack/pregate.json

A repo that shares .gstack/pregate.json through git (the pregate policy is read from the base branch) can no longer add the file without -f once browse has run. Already-tracked copies keep working, so the problem shows up only when the file is created or re-created.

The v1.91.303.0 fix (#3560) stopped browse from editing the tracked .gitignore. It does not cover this case. #3467 treats the nested * file as safe, but it also cancels the re-include.

Repro

git 2.34.1, gstack 1.91.304.0:

git init -q repro && cd repro
printf '.gstack/*\n!.gstack/pregate.json\n' > .gitignore
mkdir .gstack && echo '{}' > .gstack/pregate.json
git check-ignore --no-index -v .gstack/pregate.json   # .gitignore:2:!.gstack/pregate.json  -> not ignored
printf '*\n' > .gstack/.gitignore                      # what ensureStateDir writes
git check-ignore --no-index -v .gstack/pregate.json   # .gstack/.gitignore:1:*  -> ignored
git add .gstack/pregate.json                           # refused: "ignored by one of your .gitignore files"

Suggested fix

Have the nested file re-include the gstack files that are meant to be committed:

fs.writeFileSync(path.join(config.stateDir, '.gitignore'), '*\n!pregate.json\n!generated.json\n');

Alternatively, skip the re-include lines when the project does not track those files. The pin files .gstack/pregate.json and .gstack/generated.json are the ones gstack-pregate reads from git.

Lingua principale
TypeScript
Stelle
138k
Fork
20.5k
Merge medio
8h 32m
PR unite (30g)
292

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 garrytan/gstack

Tutte le issue di garrytan/gstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.