--ignore-files: negated pattern in a nested .gitignore is ignored when the search starts above that directory
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start by tracing how ugrep --ignore-files reads nested .gitignore files and applies negated patterns when traversal begins above the directory containing them. Reproduce with the provided shell commands, then compare root-level and sub-level searches. Done when both searches list sub/include/perf/api.h while continuing to exclude sub/perf/bin.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: ugrep 7.8.5 (debian:testing, aarch64) and 7.8.4 (macOS arm64, bundled in Claude Code). Not checked against master.
Reproduction
mkdir -p sub/include/perf sub/perf
printf 'perf\n!include/perf/\n' > sub/.gitignore
echo needle > sub/include/perf/api.h
echo needle > sub/other.c
echo x > sub/perf/bin # control: ignored by `perf`
ugrep --ignore-files -rl needle .
# sub/other.c
(cd sub && ugrep --ignore-files -rl needle .)
# include/perf/api.h
# other.c
Expected: sub/include/perf/api.h is listed in both cases. gitignore(5): a ! pattern re-includes a path excluded by a previous pattern, provided its parent directory is not excluded; here the parent sub/include/ is not. git agrees: git check-ignore -v --no-index sub/include/perf/api.h exits 1 (not ignored), while a control file sub/perf/bin is reported ignored by sub/.gitignore:1:perf.
Real-world case: the Linux kernel's tools/perf/.gitignore has perf followed by !include/perf/. Searching from the kernel root with --ignore-files omits tools/perf/include/perf/perf_dlfilter.h, the canonical definition of struct perf_dlfilter_fns, while still returning documentation and test copies (exit 0). Started from tools/perf/, the header is found.
Impact note: Claude Code's native macOS/Linux builds run grep as ugrep --ignore-files -I ..., so AI coding agents hit this on recursive searches from a repository root. Survey and scripts: https://github.com/bsbhadwal/claude-code-grep-survey
Thanks for ugrep.
- Lingua principale
- C++
- Stelle
- 3.3k
- Fork
- 148
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Genivia/ugrep
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 67/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
Tutte le issue di Genivia/ugrep
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
compiler-explorer/compiler-explorer#9738 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
FreqScanner: Run with no enabled frequencies silently stalls in START_SCAN and keeps stale power resultsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno