Two conflicts instead of one for renamed file
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
- 35/100
Hướng nghiên cứu
Tái hiện xung đột bằng cách sử dụng repository test_git được liên kết và phương thức Pull với MergeOptions.FindRenames được bật. Bắt đầu bằng cách kiểm tra Commands.Pull, repo.Merge và repo.Index.Conflicts; công việc được hoàn tất khi trường hợp tệp được đổi tên báo cáo một xung đột với các giá trị Ancestor, Ours và Theirs như mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Reproduction steps
- Checkout commit https://github.com/ydanila/test_git from https://github.com/ydanila/test_git
- Renamed README.md to README2.md and commit (will be marked as renamed)
- Pull changes from 'main' using this code
public void Pull(string branch)
{
using (var repo = new Repository(this.repoPath))
{
Configuration config = repo.Config;
var mergeOptions = new MergeOptions
{
FailOnConflict = true,
OnCheckoutProgress = OnCheckoutProgress
};
PullOptions options = new PullOptions
{
FetchOptions = new FetchOptions { CredentialsProvider = this.GetCredentialsProvider() },
MergeOptions = mergeOptions
};
var trackingBranch = repo.Branches[branch];
Signature buildSignature = config.BuildSignature(DateTimeOffset.Now);
var mergeResult = Commands.Pull(repo, buildSignature, options);
if (mergeResult.Status == MergeStatus.Conflicts)
{
repo.Merge(trackingBranch.TrackedBranch, buildSignature);
ConflictCollection conflicts = repo.Index.Conflicts;
var changes = new List<ContentChanges>();
foreach (Conflict conflict in conflicts)
{
// ...
}
}
}
}
Expected behavior
As mergeOptions.FindRenames == true it returns one conflict which has Ancestor==Readme.md, Ours==Readme2.md and Theirs==null (file deleted)
Actual behavior
It returns two conflicts.
First:

Second:

Version of LibGit2Sharp (release number or SHA1)
Latest: 4daf6189b0e20f878348b262d1846eb25bc6d7f6
Operating system(s) tested; .NET runtime tested
Windows .Net Fw 4.7.2
- 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
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/libgit2sharp
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
libgit2/libgit2sharp#2193 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
libgit2/libgit2sharp#2192 · 1 bình luận ·
-
Website is down Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
libgit2/libgit2sharp#2191 · 2 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
libgit2/libgit2sharp#2189 · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
libgit2/libgit2sharp#2187 · 2 bình luận ·