8000 Introduce Repository.Index.Conflicts.Names · GiTechLab/libgit2sharp@413a892 · GitHub
[go: up one dir, main page]

Skip to content

Commit 413a892

Browse files
Edward Thomsonnulltoken
Edward Thomson
authored andcommitted
Introduce Repository.Index.Conflicts.Names
1 parent 86e561d commit 413a892

File tree

452 files changed

+1081
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

452 files changed

+1081
-2
lines changed

LibGit2Sharp.Tests/ConflictFixture.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ public static IEnumerable<object[]> ConflictData
2727
}
2828
}
2929

30+
private static List<object[]> RenameConflictData
31+
{
32+
get
33+
{
34+
return new List<object[]>
35+
{
36+
new[] { "3a-renamed-in-ours-deleted-in-theirs.txt", "3a-newname-in-ours-deleted-in-theirs.txt", null },
37+
new[] { "3b-renamed-in-theirs-deleted-in-ours.txt", null, "3b-newname-in-theirs-deleted-in-ours.txt" },
38+
new[] { "4a-renamed-in-ours-added-in-theirs.txt", "4a-newname-in-ours-added-in-theirs.txt", null },
39+
new[] { "4b-renamed-in-theirs-added-in-ours.txt", null, "4b-newname-in-theirs-added-in-ours.txt" },
40+
new[] { "5a-renamed-in-ours-added-in-theirs.txt", "5a-newname-in-ours-added-in-theirs.txt", "5a-renamed-in-ours-added-in-theirs.txt" },
41+
new[] { "5b-renamed-in-theirs-added-in-ours.txt", "5b-renamed-in-theirs-added-in-ours.txt", "5b-newname-in-theirs-added-in-ours.txt" },
42+
new[] { "6-both-renamed-1-to-2.txt", "6-both-renamed-1-to-2-ours.txt", "6-both-renamed-1-to-2-theirs.txt" },
43+
new[] { "7-both-renamed-side-1.txt", "7-both-renamed.txt", "7-both-renamed-side-1.txt" },
44+
new[] { "7-both-renamed-side-2.txt", "7-both-renamed-side-2.txt", "7-both-renamed.txt" },
45+
};
46+
}
47+
}
48+
3049
[Theory]
3150
[InlineData(true, "ancestor-and-ours.txt", true, false, FileStatus.Removed, 2)]
3251
[InlineData(false, "ancestor-and-ours.txt", true, true, FileStatus.Removed |FileStatus.Untracked, 2)]
@@ -75,6 +94,29 @@ public void CanResolveConflictsByRemovingFromTheIndex(
7594
}
7695
}
7796

97+
[Fact]
98+
public void CanGetOriginalNamesOfRenameConflicts()
99+
{
100+
var path = CloneMergeRenamesTestRepo();
101+
using (var repo = new Repository(path))
102+
{
103+
var expected = RenameConflictData;
104+
var actual = repo.Index.Conflicts.Names;
105+
106+
Assert.Equal(expected.Count, actual.Count());
107+
108+
int i = 0;
109+
foreach(var name in actual)
110+
{
111+
Assert.Equal(expected[i][0], name.Ancestor);
112+
Assert.Equal(expected[i][1], name.Ours);
113+
Assert.Equal(expected[i][2], name.Theirs);
114+
115+
i++;
116+
}
117+
}
118+
}
119+
78120
[Theory, PropertyData("ConflictData")]
79121
public void CanRetrieveSingleConflictByPath(string filepath, string ancestorId, string ourId, string theirId)
80122
{
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
there is no change in this file.
2+
there is no change in this file.
3+
there is no change in this file.
4+
there is no change in this file.
5+
there is no change in this file.
6+
there is no change in this file.
7+
there is no change in this file.
8+
there is no change in this file.
9+
there is no change in this file.
10+
there is no change in this file.
11+
there is no change in this file.
12+
there is no change in this file.
13+
there is no change in this file.
14+
there is no change in this file.
15+
there is no change in this file.
16+
there is no change in this file.
17+
there is no change in this file.
18+
there is no change in this file.
19+
there is no change in this file.
20+
there is no change in this file.
21+
there is no change in this file.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
this file will be rewritten in
2+
ours, and its contents will be
3+
duplicated in another file.
4+
but it will not be eligible for
5+
rename detection.
6+
7+
this file will be rewritten in
8+
ours, and its contents will be
9+
duplicated in another file.
10+
but it will not be eligible for
11+
rename detection.
12+
13+
this file will be rewritten in
14+
ours, and its contents will be
15+
duplicated in another file.
16+
but it will not be eligible for
17+
rename detection.
18+
19+
this file will be rewritten in
20+
ours, and its contents will be
21+
duplicated in another file.
22+
but it will not be eligible for
23+
rename detection.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
this file was rewritten in the
2+
ours branch, and the original
3+
file was copied to the file
4+
0b-duplicated-in-ours.txt. that
5+
duplicated file will not be
6+
eligible for rename detection.
7+
8+
<<<<<<< HEAD
9+
this file was rewritten in the
10+
ours branch, and the original
11+
file was copied to the file
12+
0b-duplicated-in-ours.txt. that
13+
duplicated file will not be
14+
eligible for rename detection.
15+
=======
16+
note that it has also been edited
17+
in the theirs branch
18+
19+
this file will be rewritten in
20+
ours, and its contents will be
21+
duplicated in another file.
22+
but it will not be eligible for
23+
rename detection.
24+
>>>>>>> rename_conflict_theirs
25+
26+
this file was rewritten in the
27+
ours branch, and the original
28+
file was copied to the file
29+
0b-duplicated-in-ours.txt. that
30+
duplicated file will not be
31+
eligible for rename detection.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
this file will be rewritten in
2+
theirs, and its contents will be
3+
duplicated in another file.
4+
but it will not be eligible for
5+
rename detection.
6+
7+
this file will be rewritten in
8+
theirs, and its contents will be
9+
duplicated in another file.
10+
but it will not be eligible for
11+
rename detection.
12+
13+
this file will be rewritten in
14+
theirs, and its contents will be
15+
duplicated in another file.
16+
but it will not be eligible for
17+
rename detection.
18+
19+
this file will be rewritten in
20+
theirs, and its contents will be
21+
duplicated in another file.
22+
but it will not be eligible for
23+
rename detection.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
this file was rewritten in the
2+
theirs branch, and the original
3+
file was copied to the file
4+
0c-duplicated-in-theirs.txt. that
5+
duplicated file will not be
6+
eligible for rename detection.
7+
8+
<<<<<<< HEAD
9+
note that is has also been edited
10+
in the ours branch
11+
12+
this file will be rewritten in
13+
theirs, and its contents will be
14+
duplicated in another file.
15+
but it will not be eligible for
16+
rename detection.
17+
=======
18+
this file was rewritten in the
19+
theirs branch, and the original
20+
file was copied to the file
21+
0c-duplicated-in-theirs.txt. that
22+
duplicated file will not be
23+
eligible for rename detection.
24+
>>>>>>> rename_conflict_theirs
25+
26+
this file was rewritten in the
27+
theirs branch, and the original
28+
file was copied to the file
29+
0c-duplicated-in-theirs.txt. that
30+
duplicated file will not be
31+
eligible for rename detection.
32+
33+
this file was rewritten in the
34+
theirs branch, and the original
35+
file was copied to the file
36+
0c-duplicated-in-theirs.txt. that
37+
duplicated file will not be
38+
eligible for rename detection.
39+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
this will be renamed in ours
2+
and edited in theirs
3+
4+
(indeed, it is edited in theirs)
5+
6+
this will be renamed in ours
7+
and edited in theirs
8+
9+
this will be renamed in ours
10+
and edited in theirs
11+
12+
this will be renamed in ours
13+
and edited in theirs
14+
15+
this will be renamed in ours
16+
and edited in theirs
17+
18+
this will be renamed in ours
19+
and edited in theirs
20+
21+
this will be renamed in ours
22+
and edited in theirs
23+
24+
this will be renamed in ours
25+
and edited in theirs
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
this will be renamed in ours
2+
this will be renamed in ours
3+
this will be renamed in ours
4+
this will be renamed in ours
5+
this will be renamed in ours
6+
this will be renamed in ours
7+
this will be renamed in ours
8+
this will be renamed in ours
9+
this will be renamed in ours
10+
this will be renamed in ours
11+
this will be renamed in ours
12+
this will be renamed in ours
13+
this will be renamed in ours
14+
this will be renamed in ours
15+
this will be renamed in ours
16+
this will be renamed in ours
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
this will be renamed in theirs
2+
and edited in ours
3+
4+
(and lo, it is edited in ours)
5+
6+
this will be renamed in theirs
7+
and edited in ours
8+
9+
this will be renamed in theirs
10+
and edited in ours
11+
12+
this will be renamed in theirs
13+
and edited in ours
14+
15+
this will be renamed in theirs
16+
and edited in ours
17+
18+
this will be renamed in theirs
19+
and edited in ours
20+
21+
this will be renamed in theirs
22+
and edited in ours
23+
24+
this will be renamed in theirs
25+
and edited in ours
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
this will be renamed in theirs
2+
this will be renamed in theirs
3+
this will be renamed in theirs
4+
this will be renamed in theirs
5+
this will be renamed in theirs
6+
this will be renamed in theirs
7+
this will be renamed in theirs
8+
this will be renamed in theirs
9+
this will be renamed in theirs
10+
this will be renamed in theirs
11+
this will be renamed in theirs
12+
this will be renamed in theirs
13+
this will be renamed in theirs
14+
this will be renamed in theirs
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
this file will be renamed
2+
in both branches
3+
4+
this file will be renamed
5+
in both branches
6+
7+
this file will be renamed
8+
in both branches
9+
10+
this file will be renamed
11+
in both branches
12+
13+
this file will be renamed
14+
in both branches
15+
16+
this file will be renamed
17+
in both branches
18+
19+
this file will be renamed
20+
in both branches
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
this will be renamed in ours
2+
and deleted in theirs
3+
4+
this will be renamed in ours
5+
and deleted in theirs
6+
7+
this will be renamed in ours
8+
and deleted in theirs
9+
10+
this will be renamed in ours
11+
and deleted in theirs
12+
13+
this will be renamed in ours
14+
and deleted in theirs
15+
16+
this will be renamed in ours
17+
and deleted in theirs
18+
19+
this will be renamed in ours
20+
and deleted in theirs
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
this will be renamed in ours
2+
and deleted in theirs
3+
4+
this will be renamed in ours
5+
and deleted in theirs
6+
7+
this will be renamed in ours
8+
and deleted in theirs
9+
10+
this will be renamed in ours
11+
and deleted in theirs
12+
13+
this will be renamed in ours
14+
and deleted in theirs
15+
16+
this will be renamed in ours
17+
and deleted in theirs
18+
19+
this will be renamed in ours
20+
and deleted in theirs
21+
22+
this will be renamed in ours
23+
and deleted in theirs
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
this will be renamed in ours
2+
and a file with the same name
3+
will be independently added
4+
in theirs
5+
6+
this will be renamed in ours
7+
and a file with the same name
8+
will be independently added
9+
in theirs
10+
11+
this will be renamed in ours
12+
and a file with the same name
13+
will be independently added
14+
in theirs
15+
16+
this will be renamed in ours
17+
and a file with the same name
18+
will be independently added
19+
in theirs
20+
21+
this will be renamed in ours
22+
and a file with the same name
23+
will be independently added
24+
in theirs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
this file was rewritten in
2+
theirs and will appear as an
3+
independent add of a file
4+
5+
this file was rewritten in
6+
theirs and will appear as an
7+
independent add of a file
8+
9+
this file was rewritten in
10+
theirs and will appear as an
11+
independent add of a file
12+
13+
this file was rewritten in
14+
theirs and will appear as an
15+
independent add of a file
16+
17+
this file was rewritten in
18+
theirs and will appear as an
19+
independent add of a file
20+
21+
this file was rewritten in
22+
theirs and will appear as an
23+
independent add of a file

0 commit comments

Comments
 (0)
0