Negation re-includes files under a directory excluded by a directory rule
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Riprodurre il caso con git_ignore_path_is_ignored() oppure tramite git_status/git_diff_tree_to_workdir con GIT_DIFF_INCLUDE_UNTRACKED, utilizzando il .gitignore e la struttura delle directory mostrati. Confrontare il risultato con git check-ignore d/sub/f.txt; done significa che la negazione della sottodirectory intermedia lascia comunque il file ignorato, in corrispondenza con core Git.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction steps
.gitignore:
d/
!d/sub/*
Layout:
d/
sub/
f.txt
Then query whether d/sub/f.txt is ignored, e.g. git_ignore_path_is_ignored(), or
git_status/git_diff_tree_to_workdir with GIT_DIFF_INCLUDE_UNTRACKED.
Expected behavior
d/sub/f.txt is ignored, matching core git: git check-ignore d/sub/f.txt reports it's
excluded by the d/ rule. The !d/sub/* negation has no effect because a parent directory is
excluded — per the gitignore docs: "It is not possible to re-include a file if a parent
directory of that file is excluded."
Actual behavior
libgit2 reports d/sub/f.txt as not ignored (git_ignore_path_is_ignored returns 0, and
it shows up as untracked under GIT_DIFF_INCLUDE_UNTRACKED).
Same result with d/** instead of d/, and with !d/sub/** instead of !d/sub/*.
It works correctly when the negation targets a direct child of the excluded dir
(d/sub/ + !d/sub/f.txt → ignored, agreeing with git); the divergence only appears when the
re-included path sits under an intermediate subdirectory of the excluded directory.
Version of libgit2 (release number or SHA1)
1.9.2
Operating system(s) tested
macOS 15.5 (Apple Silicon)
- Lingua principale
- C
- Stelle
- 10.6k
- Fork
- 2.7k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri 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 libgit2/libgit2
-
hashsig: the similarity heap evicts but never inserts, so the retained set is not the extremes Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Tutte le issue di libgit2/libgit2
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
libsdl-org/SDL#16360 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
zephyrproject-rtos/zephyr#119726 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
api7/lua-resty-saml#63 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
BasedHardware/omi#15320 ·