Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

UnifiedDiff for staged files with Git

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu trong CompareUIPlugin.prepareUnifiedDiff(...) và theo dõi cách IFileEditorInput, UnifiedDiffSource và fallback compare editor được chọn. So sánh đường dẫn staged index-versus-HEAD với đường dẫn unstaged workspace-file, sau đó xác định và ghi lại hành vi unified-diff được mong đợi đối với các tệp staged. Được xem là hoàn tất khi hành vi đã chọn được triển khai và được bao phủ bởi các kiểm tra so sánh liên quan.

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

Mô tả

The UnifiedDiff compares currently against a file from the workspace. As soon as a file is staged, the comparison falls back to the old compare editor as now two Git states (index vs head) are compared.

The fallback is decided in  CompareUIPlugin.prepareUnifiedDiff(...) . The unified diff needs a workspace file ( IFileEditorInput ) to overlay onto:

if (leftEditorInput instanceof IFileEditorInput) {           // working-tree side
    return new UnifiedDiffSource(..., UnifiedDiffMode.REVERT_MODE, ...);
}
if (rightEditorInput instanceof IFileEditorInput) {
    return new UnifiedDiffSource(..., UnifiedDiffMode.OVERLAY_READ_ONLY_MODE, ...);
}
return null;   // ← neither side is a workspace file → classic compare editor

• Unstaged changes (working tree vs. index/HEAD): the left side is the workspace file → unified diff works. ✅
• Staged changes (index vs. HEAD): both sides are Git revisions, neither is an  IFileEditorInput  →  prepareUnifiedDiff  returns  null  → classic compare. ❌

Not sure how we should handle that. Should we still compare against the workspace file? Or leave that to the old compare?

cc @tobiasmelcher

Ngôn ngữ chính
Java
Star
165
Fork
174
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

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.

Issue khác của eclipse-platform/eclipse.platform

Tất cả issue của eclipse-platform/eclipse.platform

Issue tương tự

Thêm issue về Java

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.