Negation re-includes files under a directory excluded by a directory rule
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Tái hiện trường hợp bằng git_ignore_path_is_ignored() hoặc thông qua git_status/git_diff_tree_to_workdir với GIT_DIFF_INCLUDE_UNTRACKED, sử dụng .gitignore và bố cục thư mục đã cho. So sánh kết quả với git check-ignore d/sub/f.txt; done có nghĩa là phép phủ định đối với thư mục con trung gian vẫn khiến tệp bị bỏ qua, khớp với core Git.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- C
- Star
- 10.6k
- Fork
- 2.7k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của libgit2/libgit2
-
hashsig: the similarity heap evicts but never inserts, so the retained set is not the extremes Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Tất cả issue của libgit2/libgit2
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
api7/lua-resty-saml#63 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
HarbourMasters/Shipwright#7229 ·