Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 4d03791

Browse files
committed
Fix merge
1 parent fa99642 commit 4d03791

File tree

9 files changed

+103
-516
lines changed

9 files changed

+103
-516
lines changed

src/GitHub.Api/Git/GitObjectFactory.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ public GitLock CreateGitLock(string path, string user, int id)
2626
var npath = new NPath(path).MakeAbsolute();
2727
var fullPath = npath.RelativeTo(environment.RepositoryPath);
2828

29-
return new GitLock {
30-
Path = path,
31-
FullPath = fullPath,
32-
User = user,
33-
ID = id
34-
};
29+
return new GitLock(path, fullPath, user, id);
3530
}
3631
}
3732
}

src/GitHub.Api/Git/Repository.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43
using System.Diagnostics;
54
using System.Globalization;
@@ -465,14 +464,14 @@ private GitBranch GetLocalGitBranch(ConfigBranch x)
465464
var trackingName = x.IsTracking ? x.Remote.Value.Name + "/" + name : "[None]";
466465
var isActive = name == CurrentBranchName;
467466

468-
return new GitBranch { Name = name, Tracking = trackingName, IsActive = isActive };
467+
return new GitBranch(name, trackingName, isActive);
469468
}
470469

471470
private static GitBranch GetRemoteGitBranch(ConfigBranch x)
472471
{
473472
var name = x.Remote.Value.Name + "/" + x.Name;
474473

475-
return new GitBranch { Name = name };
474+
return new GitBranch(name, "[None]", false);
476475
}
477476

478477
private static GitRemote GetGitRemote(ConfigRemote configRemote)

src/GitHub.Api/OutputProcessors/BranchListOutputProcessor.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ public override void LineReceived(string line)
3636
trackingName = proc.ReadChunk('[', ']');
3737
}
3838

39-
var branch = new GitBranch
40-
{
41-
Name = name,
42-
Tracking = trackingName,
43-
IsActive = active
44-
};
39+
var branch = new GitBranch(name, trackingName, active);
4540

4641
RaiseOnEntry(branch);
4742
}

src/tests/IntegrationTests/Events/RepositoryManagerTests.cs

Lines changed: 86 additions & 430 deletions
Large diffs are not rendered by default.

src/tests/IntegrationTests/Git/GitSetupTests.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,8 @@ public async Task InstallGit()
6363
.StartAsAsync();
6464

6565
gitBranches.Should().BeEquivalentTo(
66-
new GitBranch {
67-
Name = "master",
68-
Tracking = "origin/master: behind 1",
69-
IsActive = true
70-
},
71-
new GitBranch {
72-
Name = "feature/document",
73-
Tracking = "origin/feature/document",
74-
IsActive = false
75-
});
66+
new GitBranch("master", "origin/master: behind 1", true),
67+
new GitBranch("feature/document", "origin/feature/document", false));
7668
}
7769

7870

src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,8 @@ public async Task BranchListTest()
2323
.StartAsAsync();
2424

2525
gitBranches.Should().BeEquivalentTo(
26-
new GitBranch {
27-
Name = "master",
28-
Tracking = "origin/master: behind 1",
29-
IsActive = true
30-
},
31-
new GitBranch {
32-
Name = "feature/document",
33-
Tracking = "origin/feature/document",
34-
IsActive = false
35-
});
26+
new GitBranch("master", "origin/master: behind 1", true),
27+
new GitBranch("feature/document", "origin/feature/document", false));
3628
}
3729

3830
[Test]

src/tests/TestUtils/Substitutes/SubstituteFactory.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,7 @@ public IGitObjectFactory CreateGitObjectFactory(string gitRepoPath)
325325
var user = (string)info[1];
326326
var id = (int)info[2];
327327

328-
return new GitLock {
329-
Path = path,
330-
FullPath = gitRepoPath + @"\" + path,
331-
User = user,
332-
ID = id
333-
};
328+
return new GitLock(path, gitRepoPath + @"\" + path, user, id);
334329
});
335330

336331
return gitObjectFactory;

src/tests/UnitTests/IO/BranchListOutputProcessorTests.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,9 @@ public void ShouldProcessOutput()
2020

2121
AssertProcessOutput(output, new[]
2222
{
23-
new GitBranch {
24-
Name = "master",
25-
Tracking = "origin/master",
26-
IsActive = true
27-
},
28-
new GitBranch {
29-
Name = "feature/feature-1",
30-
Tracking = "",
31-
IsActive = false
32-
},
33-
new GitBranch {
34-
Name = "bugfixes/bugfix-1",
35-
Tracking = "origin/bugfixes/bugfix-1",
36-
IsActive = false
37-
},
23+
new GitBranch("master", "origin/master", true),
24+
new GitBranch("feature/feature-1", "", false),
25+
new GitBranch("bugfixes/bugfix-1", "origin/bugfixes/bugfix-1", false),
3826
});
3927
}
4028

src/tests/UnitTests/IO/LockOutputProcessorTests.cs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,8 @@ public void ShouldParseTwoLocksFormat1()
6363
};
6464

6565
var expected = new[] {
66-
new GitLock {
67-
Path = "folder/somefile.png",
68-
FullPath = TestRootPath + @"\folder/somefile.png",
69-
User = "GitHub User",
70-
ID = 12
71-
},
72-
new GitLock {
73-
Path = "somezip.zip",
74-
FullPath = TestRootPath + @"\somezip.zip",
75-
User = "GitHub User",
76-
ID = 21
77-
}
66+
new GitLock("folder/somefile.png", TestRootPath + @"\folder/somefile.png", "GitHub User", 12),
67+
new GitLock("somezip.zip", TestRootPath + @"\somezip.zip", "GitHub User", 21)
7868
};
7969

8070
AssertProcessOutput(output, expected);
@@ -91,18 +81,8 @@ public void ShouldParseTwoLocksFormat2()
9181
};
9282

9383
var expected = new[] {
94-
new GitLock {
95-
Path = "folder/somefile.png",
96-
FullPath = TestRootPath + @"\folder/somefile.png",
97-
User = "GitHub User",
98-
ID = 12
99-
},
100-
new GitLock {
101-
Path = "somezip.zip",
102-
FullPath = TestRootPath + @"\somezip.zip",
103-
User = "GitHub User",
104-
ID = 21
105-
}
84+
new GitLock("folder/somefile.png", TestRootPath + @"\folder/somefile.png", "GitHub User", 12),
85+
new GitLock("somezip.zip", TestRootPath + @"\somezip.zip", "GitHub User", 21)
10686
};
10787

10888
AssertProcessOutput(output, expected);
@@ -117,12 +97,7 @@ public void ShouldParseLocksOnFileWithNumericFirstLetter()
11797
};
11898

11999
var expected = new[] {
120-
new GitLock {
121-
Path = "2_TurtleDoves.jpg",
122-
FullPath = TestRootPath + @"\2_TurtleDoves.jpg",
123-
User = "Tree",
124-
ID = 100
125-
}
100+
new GitLock("2_TurtleDoves.jpg", TestRootPath + @"\2_TurtleDoves.jpg", "Tree", 100)
126101
};
127102

128103
AssertProcessOutput(output, expected);

0 commit comments

Comments
 (0)