Skip to content

Commit e087386

Browse files
authored
Merge pull request #1 from dotdevelop/dotdevelop1
rebase dotdevelp on dotdevelop1
2 parents 9a974f8 + c47885b commit e087386

Some content is hidden

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

56 files changed

+1088
-371
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ _ReSharper*/
4040
_NCrunch_LibGit2Sharp/
4141
packages/
4242
worktree.playlist
43+
44+
.idea/

.travis.yml

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
1-
# Travis-CI Build for libgit2sharp
2-
# see travis-ci.org for details
3-
41
language: csharp
5-
dist: trusty
6-
dotnet: 2.1.401
72
mono: none
8-
osx_image: xcode8.3
9-
10-
os:
11-
- osx
12-
- linux
13-
14-
before_install:
15-
- date -u
16-
- uname -a
17-
- env | sort
183

19-
install:
20-
- git fetch --unshallow
21-
22-
# Build libgit2, LibGit2Sharp and run the tests
23-
script:
24-
- ./buildandtest.sh 'LEAKS_IDENTIFYING'
25-
26-
# Only watch the development branch
4+
# Disable Travis-CI
275
branches:
286
only:
29-
- master
30-
- /^maint.*/
31-
32-
# Notify of build changes
33-
notifications:
34-
email:
35-
7+
- NOTTHISONE

CONTRIBUTING.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ We love Pull Requests! Your contributions help make LibGit2Sharp great.
44

55
## Getting Started
66

7-
So you want to contribute to LibGit2Sharp. Great! Contributions take many forms from
7+
So you want to contribute to LibGit2Sharp. Great! Contributions take many forms from
88
submitting issues, writing documentation, to making code changes. We welcome it all.
99

1010
But first things first...
@@ -14,18 +14,25 @@ But first things first...
1414
* Clearly describe the issue including steps to reproduce when it is a bug.
1515
* Make sure you fill in the earliest version that you know has the issue.
1616
* Fork the repository on GitHub, then clone it using your favorite Git client.
17-
* Make sure the project builds and all tests pass on your machine by running
17+
* Make sure the project builds and all tests pass on your machine by running
1818
the `buildandtest.cmd` script on Windows or `buildandtest.sh` on Linux/Mac.
1919

2020
## LibGit2
2121

2222
LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.
23-
LibGit2 is a git submodule referencing the [libgit2 project](https://github.com/libgit2/libgit2). To learn more about
23+
LibGit2 is a git submodule referencing the [libgit2 project](https://github.com/libgit2/libgit2). To learn more about
2424
submodules read [here](http://git-scm.com/book/en/v2/Git-Tools-Submodules).
2525
To build libgit2 see [here](https://github.com/libgit2/libgit2sharp/wiki/How-to-build-x64-libgit2-and-LibGit2Sharp).
2626

2727
## Making Changes
2828

29+
Make sure you have the required .NET Core SDK and runtimes installed.
30+
The easiest way to do this is run our `tools\Install-DotNetSdk.ps1` script.
31+
Using the `-InstallLocality Machine` switch requires elevation but ensures
32+
that Visual Studio will be able to load the solution even when launched from a shortcut.
33+
34+
Then proceed to:
35+
2936
* Create a topic branch off master (don't work directly on master).
3037
* Implement your feature or fix your bug. Please following existing coding styles and do not introduce new ones.
3138
* Make atomic, focused commits with good commit messages.
@@ -42,7 +49,7 @@ Some things that will increase the chance that your pull request is accepted.
4249
* Following existing code conventions.
4350
* Including unit tests that would otherwise fail without the patch, but pass after applying it.
4451
* Updating the documentation and tests that are affected by the contribution.
45-
* If code from elsewhere is used, proper credit and a link to the source should exist in the code comments.
52+
* If code from elsewhere is used, proper credit and a link to the source should exist in the code comments.
4653
Then licensing issues can be checked against LibGit2Sharp's very permissive MIT based open source license.
4754
* Having a configured git client that converts line endings to LF. [See here.](https://help.github.com/articles/dealing-with-line-endings/).
4855
# Additional Resources

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
55
<OutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
66
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
7+
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\Packages\$(Configuration)\</PackageOutputPath>
78
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants>
89
</PropertyGroup>
910

11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
13+
</ItemGroup>
1014
</Project>

Directory.Build.targets

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project>
2-
3-
<PropertyGroup>
4-
<PublicSign Condition=" '$(AssemblyOriginatorKeyFile)' != '' and '$(OS)' != 'Windows_NT' ">true</PublicSign>
2+
<PropertyGroup Condition=" '$(IsTestProject)' == 'true' ">
3+
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
4+
<Exclude>[xunit.*]*</Exclude>
5+
<!-- Ensure we preserve each coverlet output file per target framework: https://github.com/tonerdo/coverlet/issues/177 -->
6+
<CoverletOutput>$(OutputPath)/</CoverletOutput>
57
</PropertyGroup>
6-
78
</Project>

LibGit2Sharp.Tests/CloneFixture.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,6 @@ public void CanInspectCertificateOnClone(string url, string hostname, Type certT
297297
Assert.True(checksHappy);
298298
}
299299

300-
[Fact]
301-
public void CloningAnUrlWithoutPathThrows()
302-
{
303-
var scd = BuildSelfCleaningDirectory();
304-
305-
Assert.Throws<InvalidSpecificationException>(() => Repository.Clone("http://github.com", scd.DirectoryPath));
306-
}
307-
308300
[Theory]
309301
[InlineData("git://github.com/libgit2/TestGitRepository")]
310302
public void CloningWithoutWorkdirPathThrows(string url)

LibGit2Sharp.Tests/CommitFixture.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,8 @@ public void CanPrettifyAMessage()
10581058
}
10591059

10601060
private readonly string signedCommit =
1061-
"tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n" +
1062-
"parent 34734e478d6cf50c27c9d69026d93974d052c454\n" +
1061+
"tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n" +
1062+
"parent 8496071c1b46c854b31185ea97743be6a8774479\n" +
10631063
"author Ben Burkert <[email protected]> 1358451456 -0800\n" +
10641064
"committer Ben Burkert <[email protected]> 1358451456 -0800\n" +
10651065
"gpgsig -----BEGIN PGP SIGNATURE-----\n" +
@@ -1102,8 +1102,8 @@ public void CanPrettifyAMessage()
11021102
"-----END PGP SIGNATURE-----";
11031103

11041104
private readonly string signedData =
1105-
"tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n" +
1106-
"parent 34734e478d6cf50c27c9d69026d93974d052c454\n" +
1105+
"tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n" +
1106+
"parent 8496071c1b46c854b31185ea97743be6a8774479\n" +
11071107
"author Ben Burkert <[email protected]> 1358451456 -0800\n" +
11081108
"committer Ben Burkert <[email protected]> 1358451456 -0800\n" +
11091109
"\n" +
@@ -1155,7 +1155,7 @@ public void CanCreateACommitString()
11551155
[Fact]
11561156
public void CanCreateASignedCommit()
11571157
{
1158-
string repoPath = InitNewRepository();
1158+
string repoPath = SandboxStandardTestRepo();
11591159
using (var repo = new Repository(repoPath))
11601160
{
11611161
var odb = repo.ObjectDatabase;

LibGit2Sharp.Tests/ConfigurationFixture.cs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,119 @@ public void CanUnsetAnEntryFromTheGlobalConfiguration()
5050
}
5151
}
5252

53+
[Fact]
54+
public void CanAddAndReadMultivarFromTheLocalConfiguration()
55+
{
56+
string path = SandboxStandardTestRepo();
57+
using (var repo = new Repository(path))
58+
{
59+
Assert.Empty(repo.Config
60+
.OfType<ConfigurationEntry<string>>()
61+
.Where(x => x.Key == "unittests.plugin"));
62+
63+
repo.Config.Add("unittests.plugin", "value1", ConfigurationLevel.Local);
64+
repo.Config.Add("unittests.plugin", "value2", ConfigurationLevel.Local);
65+
66+
Assert.Equal(new[] { "value1", "value2" }, repo.Config
67+
.OfType<ConfigurationEntry<string>>()
68+
.Where(x => x.Key == "unittests.plugin" && x.Level == ConfigurationLevel.Local)
69+
.Select(x => x.Value)
70+
.ToArray());
71+
}
72+
}
73+
74+
[Fact]
75+
public void CanAddAndReadMultivarFromTheGlobalConfiguration()
76+
{
77+
string path = SandboxBareTestRepo();
78+
using (var repo = new Repository(path))
79+
{
80+
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
81+
Assert.Empty(repo.Config
82+
.OfType<ConfigurationEntry<string>>()
83+
.Where(x => x.Key == "unittests.plugin"));
84+
85+
repo.Config.Add("unittests.plugin", "value1", ConfigurationLevel.Global);
86+
repo.Config.Add("unittests.plugin", "value2", ConfigurationLevel.Global);
87+
88+
Assert.Equal(new[] { "value1", "value2" }, repo.Config
89+
.OfType<ConfigurationEntry<string>>()
90+
.Where(x => x.Key == "unittests.plugin")
91+
.Select(x => x.Value)
92+
.ToArray());
93+
}
94+
}
95+
96+
[Fact]
97+
public void CanUnsetAllFromTheGlobalConfiguration()
98+
{
99+
string path = SandboxBareTestRepo();
100+
using (var repo = new Repository(path))
101+
{
102+
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
103+
Assert.Empty(repo.Config
104+
.OfType<ConfigurationEntry<string>>()
105+
.Where(x => x.Key == "unittests.plugin")
106+
.Select(x => x.Value)
107+
.ToArray());
108+
109+
repo.Config.Add("unittests.plugin", "value1", ConfigurationLevel.Global);
110+
repo.Config.Add("unittests.plugin", "value2", ConfigurationLevel.Global);
111+
112+
Assert.Equal(2, repo.Config
113+
.OfType<ConfigurationEntry<string>>()
114+
.Where(x => x.Key == "unittests.plugin" && x.Level == ConfigurationLevel.Global)
115+
.Select(x => x.Value)
116+
.Count());
117+
118+
repo.Config.UnsetAll("unittests.plugin");
119+
120+
Assert.Equal(2, repo.Config
121+
.OfType<ConfigurationEntry<string>>()
122+
.Where(x => x.Key == "unittests.plugin" && x.Level == ConfigurationLevel.Global)
123+
.Select(x => x.Value)
124+
.Count());
125+
126+
repo.Config.UnsetAll("unittests.plugin", ConfigurationLevel.Global);
127+
128+
Assert.Empty(repo.Config
129+
.OfType<ConfigurationEntry<string>>()
130+
.Where(x => x.Key == "unittests.plugin")
131+
.Select(x => x.Value)
132+
.ToArray());
133+
}
134+
}
135+
136+
[Fact]
137+
public void CanUnsetAllFromTheLocalConfiguration()
138+
{
139+
string path = SandboxStandardTestRepo();
140+
using (var repo = new Repository(path))
141+
{
142+
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
143+
Assert.Empty(repo.Config
144+
.OfType<ConfigurationEntry<string>>()
145+
.Where(x => x.Key == "unittests.plugin")
146+
.Select(x => x.Value)
147+
.ToArray());
148+
149+
repo.Config.Add("unittests.plugin", "value1");
150+
repo.Config.Add("unittests.plugin", "value2");
151+
152+
Assert.Equal(2, repo.Config
153+
.OfType<ConfigurationEntry<string>>()
154+
.Where(x => x.Key == "unittests.plugin" && x.Level == ConfigurationLevel.Local)
155+
.Select(x => x.Value)
156+
.Count());
157+
158+
repo.Config.UnsetAll("unittests.plugin");
159+
160+
Assert.Empty(repo.Config
161+
.OfType<ConfigurationEntry<string>>()
162+
.Where(x => x.Key == "unittests.plugin"));
163+
}
164+
}
165+
53166
[Fact]
54167
public void CanReadBooleanValue()
55168
{

LibGit2Sharp.Tests/GlobalSettingsFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public void CanGetMinimumCompiledInFeatures()
2222
public void CanRetrieveValidVersionString()
2323
{
2424
// Version string format is:
25-
// Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
25+
// Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
2626
// Example output:
27-
// "0.25.0-preview.52+g871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
27+
// "0.25.0-preview.52+871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
2828

2929
string versionInfo = GlobalSettings.Version.ToString();
3030

@@ -33,14 +33,14 @@ public void CanRetrieveValidVersionString()
3333
// git2SharpHash: '871d13a67f' LibGit2Sharp hash.
3434
// arch: 'x86' or 'x64' libgit2 target.
3535
// git2Features: 'Threads, Ssh' libgit2 features compiled with.
36-
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+(g(?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
36+
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+((?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
3737

3838
Assert.NotNull(versionInfo);
3939

4040
Match regexResult = Regex.Match(versionInfo, regex);
4141

4242
Assert.True(regexResult.Success, "The following version string format is enforced:" +
43-
"Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
43+
"Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
4444
"But found \"" + versionInfo + "\" instead.");
4545
}
4646

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net46;netcoreapp2.1</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -11,23 +11,21 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
15-
<PackageReference Include="Moq" Version="4.9.0" />
16-
<PackageReference Include="xunit" Version="2.4.0" />
17-
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
19-
<PackageReference Include="xunit.skippablefact" Version="1.3.6" />
14+
<PackageReference Include="coverlet.msbuild" Version="2.7.0" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
16+
<PackageReference Include="Moq" Version="4.10.1" />
17+
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
18+
<PackageReference Include="xunit" Version="2.4.1" />
19+
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
20+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
21+
<PackageReference Include="xunit.skippablefact" Version="1.3.12" />
2022
</ItemGroup>
2123

2224
<ItemGroup>
2325
<Compile Include="..\LibGit2Sharp\Core\Platform.cs" Link="TestHelpers\Platform.cs" />
24-
<Compile Remove="desktop\**" Condition=" '$(TargetFramework)' != 'net46' " />
25-
</ItemGroup>
26-
27-
<ItemGroup>
28-
<Content Include="Resources\**\*.*">
29-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
30-
</Content>
26+
<Compile Remove="desktop\**" Condition="'$(TargetFramework)' != 'net46'" />
27+
<Content Include="Resources\**\*.*" CopyToOutputDirectory="PreserveNewest" />
28+
<None Update="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
3129
</ItemGroup>
3230

3331
<Target Name="CopyTestAppExes" AfterTargets="ResolveProjectReferences">
@@ -43,4 +41,4 @@
4341

4442
<Import Project="..\Targets\GenerateNativeDllName.targets" />
4543

46-
</Project>
44+
</Project>

0 commit comments

Comments
 (0)