libgit2 / libgit2/libgit2sharp

Two conflicts instead of one for renamed file

Đang mở
#1,931 2 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
  1. Checkout commit https://github.com/ydanila/test_git from https://github.com/ydanila/test_git
  2. Renamed README.md to README2.md and commit (will be marked as renamed)
  3. 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:
2021-12-06 20_58_25-Window
Second:
2021-12-06 21_06_05-Aehnlich (Отладка) - Microsoft Visual Studio

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

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

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

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.