libgit2 / libgit2/libgit2sharp
Two conflicts instead of one for renamed file
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
- 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
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
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.
Đánh giá
- Công nghệ
- csharp, 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
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100