libgit2 / libgit2/libgit2sharp

MergeOptions: TargetLimit (merge.renameLimit) is being ignored during merge operation

Đang mở
#1,982 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
C#
Star
3.5k
Fork
925
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Reproduction steps

The sourceBranch and targetBranch has a commonAncestorCommit with an existing file Foo.cs. A lot of (let's say: 3000) other files exist too.

The sourceBranch contains one single extra commit on top of commonAncestorCommit with a modification inside a file Foo.cs.

The targetBranch (current branch) contains one single extra commit on top of commonAncestorCommit in which the file Foo.cs has been renamed to Bar.cs, and a lot of (let's say: 2000) other files have also been renamed.

The following merge from sourceBranch to targetBranch ignores TargetLimit (merge.renameLimit), and causes an unnecessary conflict:

using (var repo = new Repository(...))
{
    Commands.Checkout(repo, targetBranch);
    var mergeOptions = new MergeOptions { TargetLimit = 7000 };
    repo.Merge(sourceBranch, mergerSignature, mergeOptions)
}
Expected behavior

A successful merge without conflict.

Actual behavior

We are staying in the ongoing merge operation, and the git status reports conflict for the file Foo.cs stating that it has been "deleted by us".

Note that the plain git merge command can merge this without conflicts if the merge.renameLimit setting is set to 7000 in the .gitconfig file.

Version of LibGit2Sharp (release number or SHA1)

LibGit2Sharp 0.26.2
LibGit2Sharp 0.27.0-preview-0182

Operating system(s) tested; .NET runtime tested

Windows 10 Enterprise N
.NET 6.0.8

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 lần theo giá trị MergeOptions.TargetLimit từ repo.Merge qua thao tác merge, đồng thời so sánh với cách lệnh git merge đọc merge.renameLimit từ .gitconfig. Tái hiện kịch bản Foo.cs-to-Bar.cs với bố cục branch được cung cấp và xác minh rằng merge hoàn tất mà không có xung đột khi TargetLimit là 7000.

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

Đánh giá

Công nghệ
csharp, git
Lĩnh vực
tooling
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
Khá rõ ràng
Mức phù hợp với người mới
38/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.