Skip to content

Commit 40832ff

Browse files
committed
Merge remote-tracking branch 'upstream/dotnetcore' into portable2
2 parents ea00328 + b856f9b commit 40832ff

File tree

6 files changed

+30
-47
lines changed

6 files changed

+30
-47
lines changed

.travis.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,21 @@
22
# see travis-ci.org for details
33

44
language: csharp
5-
mono:
6-
- latest
5+
dist: trusty
6+
dotnet: 1.0.1
7+
mono: none
78

89
os:
910
- osx
1011
- linux
1112

12-
env:
13-
global:
14-
- MONO_OPTIONS=--debug
15-
16-
install:
17-
- curl -L -o nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
18-
- mono nuget.exe restore LibGit2Sharp.sln
19-
2013
before_install:
2114
- date -u
2215
- uname -a
2316
- env | sort
24-
- nuget help
2517

26-
solution: LibGit2Sharp.sln
18+
install:
19+
- git fetch --unshallow
2720

2821
# Build libgit2, LibGit2Sharp and run the tests
2922
script:
@@ -35,6 +28,7 @@ branches:
3528
- master
3629
- /^maint.*/
3730
- portable
31+
- dotnetcore
3832

3933
# Notify of build changes
4034
notifications:

LibGit2Sharp.Tests/BranchFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
11131113

11141114
using (var emptyRepo = new Repository(repoPath))
11151115
{
1116-
uri = new Uri(emptyRepo.Info.Path);
1116+
uri = new Uri($"file://{emptyRepo.Info.Path}");
11171117
}
11181118

11191119
SelfCleaningDirectory scd2 = BuildSelfCleaningDirectory();

LibGit2Sharp.Tests/CloneFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void AssertLocalClone(string url, string path = null, bool isCloningAnEm
8181
[Fact]
8282
public void CanCloneALocalRepositoryFromALocalUri()
8383
{
84-
var uri = new Uri(Path.GetFullPath(BareTestRepoPath));
84+
var uri = new Uri($"file://{Path.GetFullPath(BareTestRepoPath)}");
8585
AssertLocalClone(uri.AbsoluteUri, BareTestRepoPath);
8686
}
8787

@@ -361,7 +361,7 @@ private class CloneCallbackInfo
361361
[Fact]
362362
public void CanRecursivelyCloneSubmodules()
363363
{
364-
var uri = new Uri(Path.GetFullPath(SandboxSubmoduleSmallTestRepo()));
364+
var uri = new Uri($"file://{Path.GetFullPath(SandboxSubmoduleSmallTestRepo())}");
365365
var scd = BuildSelfCleaningDirectory();
366366
string relativeSubmodulePath = "submodule_target_wd";
367367

@@ -512,7 +512,7 @@ public void CanRecursivelyCloneSubmodules()
512512
[Fact]
513513
public void CanCancelRecursiveClone()
514514
{
515-
var uri = new Uri(Path.GetFullPath(SandboxSubmoduleSmallTestRepo()));
515+
var uri = new Uri($"file://{Path.GetFullPath(SandboxSubmoduleSmallTestRepo())}");
516516
var scd = BuildSelfCleaningDirectory();
517517
string relativeSubmodulePath = "submodule_target_wd";
518518

LibGit2Sharp.Tests/FetchFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void CanFetchAllTagsAfterAnInitialClone()
207207
public void FetchHonorsTheFetchPruneConfigurationEntry()
208208
{
209209
var source = SandboxBareTestRepo();
210-
var url = new Uri(Path.GetFullPath(source)).AbsoluteUri;
210+
var url = new Uri($"file://{Path.GetFullPath(source)}").AbsoluteUri;
211211

212212
var scd = BuildSelfCleaningDirectory();
213213

LibGit2Sharp.Tests/TestHelpers/Constants.cs

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,44 +55,32 @@ public static string BuildPath()
5555
{
5656
string tempPath = null;
5757

58-
if (IsRunningOnUnix)
58+
const string LibGit2TestPath = "LibGit2TestPath";
59+
60+
// We're running on .Net/Windows
61+
if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
5962
{
60-
// We're running on Mono/*nix. Let's unwrap the path
61-
tempPath = UnwrapUnixTempPath();
63+
Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
64+
tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
6265
}
63-
else
66+
67+
if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
68+
{
69+
Trace.TraceInformation("Using default test path value");
70+
tempPath = Path.GetTempPath();
71+
}
72+
73+
//workaround macOS symlinking its temp folder
74+
if (tempPath.StartsWith("/var"))
6475
{
65-
const string LibGit2TestPath = "LibGit2TestPath";
66-
67-
// We're running on .Net/Windows
68-
if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
69-
{
70-
Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
71-
tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
72-
}
73-
74-
if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
75-
{
76-
Trace.TraceInformation("Using default test path value");
77-
tempPath = Path.GetTempPath();
78-
}
76+
tempPath = "/private" + tempPath;
7977
}
8078

8179
string testWorkingDirectory = Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
8280
Trace.TraceInformation("Test working directory set to '{0}'", testWorkingDirectory);
8381
return testWorkingDirectory;
8482
}
8583

86-
private static string UnwrapUnixTempPath()
87-
{
88-
var type = Type.GetType("Mono.Unix.UnixPath, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
89-
90-
return (string)type.GetMethod("GetCompleteRealPath",
91-
BindingFlags.Static | BindingFlags.FlattenHierarchy |
92-
BindingFlags.InvokeMethod | BindingFlags.Public).Invoke(
93-
null, new object[] { Path.GetTempPath() });
94-
}
95-
9684
// To help with creating secure strings to test with.
9785
internal static SecureString StringToSecureString(string str)
9886
{

build.libgit2sharp.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ EXTRADEFINE="$1"
99
# working directory in its library search path, so it works without this value.
1010
export LD_LIBRARY_PATH=.
1111

12-
nuget restore
13-
xbuild CI/build.msbuild /target:Deploy /property:ExtraDefine="$EXTRADEFINE"
12+
dotnet restore
13+
dotnet build LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -c Release -f netcoreapp1.0 /property:ExtraDefine="$EXTRADEFINE"
14+
dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -c Release -f netcoreapp1.0 --no-build
1415

1516
exit $?

0 commit comments

Comments
 (0)