libgit2 / libgit2/pygit2

checking to see if diffFile is a submodule.

Đang mở
#838 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
1.7k
Fork
408
Merge trung bình
2 ngày 57 phút
Pull request đã merge (30 ngày)
7

Mô tả

Is there a way to check to see if a diffFile is a submodule?

The repo that I'm getting my diff deltas from is bare so there's no working directory for Repository.lookup_submodule(path) or Repository.listall_submodules() to work with.

The main issue is when I try to get an added file via something like:

new_file = git_repo[delta.new_file.id]

I get the following key error.

Traceback (most recent call last):
  File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/user/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/user/project/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/user/project/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/user/project/repos/views.py", line 105, in get
    new_file = git_repo[delta.new_file.id]
  File "/Users/user/project/venv/lib/python3.7/site-packages/pygit2/repository.py", line 121, in __getitem__
    raise KeyError(key)
KeyError: ffeef8955335d0ec95f23c2fd75821672cf14bb9

If it's a submodule I don't need the contents. I just need to know that it's a submodule. Is there a general way to do this?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách đọc phần xử lý xung quanh delta.new_file.id và các API Repository.lookup_submodule(path) và Repository.listall_submodules(), đặc biệt đối với bare repositories. Kiểm tra cách một mục diff xác định một submodule mà không tải nội dung của nó. Công việc được xem là hoàn tất khi một cách đáng tin cậy để phân biệt các mục submodule trước khi lập chỉ mục repository được ghi lại hoặc cung cấp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
git, python
Lĩnh vực
devtools
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.