git_status_list with pathspec and disable_pathspec_match not returning untracked items in subdirectories
Chưa có ai nhận issue này.
- 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
Mô tả
I think there might be something slightly incorrect about libgit2's handling of status lists for untracked files within subdirectories when scoping specifically to a file by pathspec.
Reproduction steps
Consider I have a repository with the following structure, where the Committed files are checked in to the repository, and Uncommitted files are untracked in the working directory:
root/
Committed.txt
Uncommitted.txt
subdirectory/
Committed2.txt
Uncommitted2.txt
I'm calling git_status_list_new with the following options and flags:
.pathspec = "subdirectory/Uncommitted2.txt"
GIT_STATUS_OPT_INCLUDE_UNTRACKED
GIT_STATUS_OPT_INCLUDE_UNMODIFIED
GIT_STATUS_OPT_INCLUDE_IGNORED
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH
In this case, no entries are returned for the file. If I switch the path spec to just "Uncommitted.txt", it works and returns an entry with the GIT_STATUS_WT_NEW status. Similarly, if I create a status list without any pathspec returning all files, an entry for the file is included.
I believe the subdirectory itself is considered committed, since Committed2.txt is committed. If I add the GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS flag, it also works as expected for the subdirectory, but this has a bit of overhead for directories that are fully untracked.
I suspect this is not working as intended (since it works for the root case, just not in subdirectories). If this is not the case, or I'm somehow using the pathspec matching incorrectly, let me know!
I will attach an example repository (although it's not too complex).
Expected behavior
The status list should return one entry with GIT_STATUS_WT_NEW status for the second uncommitted file.
Actual behavior
No entries are returned in the status list.
Version of libgit2 (release number or SHA1)
Checked with the latest version, e056862.
Operating system(s) tested
macOS 10.12.5
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.
Hướng nghiên cứu
Bắt đầu với git_status_list_new và tái hiện trường hợp pathspec của thư mục con bằng GIT_STATUS_OPT_INCLUDE_UNTRACKED, GIT_STATUS_OPT_INCLUDE_UNMODIFIED, GIT_STATUS_OPT_INCLUDE_IGNORED và GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH. So sánh với trường hợp tệp ở thư mục gốc và trường hợp không có pathspec. Hoàn tất khi danh sách trạng thái trả về tệp trong thư mục con với GIT_STATUS_WT_NEW mà không cần GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, git
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100