diff --git a/.gitignore b/.gitignore index d36403d..30482bd 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ ipch/ # Visual Studio profiler *.psess *.vsp +.vs/ # ReSharper is a .NET coding add-in _ReSharper* @@ -128,4 +129,4 @@ src/_NCrunch_GitTools.Core/ #################### # JetBrains IDEs #################### -.idea \ No newline at end of file +.idea diff --git a/.travis.yml b/.travis.yml index 8893245..29b2922 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,14 @@ language: csharp solution: src/GitTools.Core.sln sudo: false -dotnet: 1.0.3 -dist: trusty +dotnet: 2.2.101 +dist: xenial mono: none -addons: - apt: - sources: - - sourceline: 'deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main' - key_url: 'https://apt-mo.trafficmanager.net/keys/microsoft.asc' - packages: - - dotnet-dev-1.0.3 install: # - sudo nuget update -self - - dotnet restore "./src/GitTools.Core.sln" + - dotnet restore ./src/ script: - - dotnet restore "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" /p:TargetFramework=netcoreapp1.1 /verbosity:detailed - - dotnet build "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --configuration Debug --framework netcoreapp1.1 /verbosity:detailed - - dotnet test "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" --framework netcoreapp1.1 --filter TestCategory!=NoMono + - dotnet restore "./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj" /p:TargetFramework=netcoreapp2.0 + - dotnet build ./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj --configuration Debug --framework netcoreapp2.0 -v:Normal + - dotnet test ./src/GitTools.Core.Tests/GitTools.Core.Tests.csproj --no-build --framework netcoreapp2.0 --filter TestCategory!=NoMono -v:Normal # - mono --debug --runtime=v4.0.30319 %userprofile%.nuget/packages/nunit.consolerunner/3.6.1/tools/nunit3-console.exe ./output/debug/GitTools.Core.Tests/net45/GitTools.Core.Tests.dll -where "cat != NoMono" diff --git a/src/GitTools.Core.Tests/Git/DynamicRepositoriesTests.cs b/src/GitTools.Core.Tests/Git/DynamicRepositoriesTests.cs index 21843fd..0b777cc 100644 --- a/src/GitTools.Core.Tests/Git/DynamicRepositoriesTests.cs +++ b/src/GitTools.Core.Tests/Git/DynamicRepositoriesTests.cs @@ -32,7 +32,7 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte { using (var fixture = new EmptyRepositoryFixture()) { - var expectedDynamicRepoLocation = Path.Combine(tempPath, fixture.RepositoryPath.Split(Path.DirectorySeparatorChar).Last()); + var expectedDynamicRepoLocation = Path.Combine(tempPath, fixture.RepositoryPath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).Last()); fixture.Repository.MakeCommits(5); fixture.Repository.CreateFileAndCommit("TestFile.txt"); @@ -50,7 +50,7 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte using (var dynamicRepository = DynamicRepositories.CreateOrOpen(repositoryInfo, tempPath, branchName, branch.Tip.Sha)) { dynamicRepositoryPath = dynamicRepository.Repository.Info.Path; - dynamicRepository.Repository.Info.Path.ShouldBe(Path.Combine(expectedDynamicRepoLocation, ".git\\")); + dynamicRepository.Repository.Info.Path.ShouldBe(Path.Combine(expectedDynamicRepoLocation, ".git" + Path.DirectorySeparatorChar)); var currentBranch = dynamicRepository.Repository.Head.CanonicalName; @@ -130,7 +130,7 @@ public void PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken() { var head = fixture.Repository.CreateFileAndCommit("TestFile.txt"); File.Copy(Path.Combine(fixture.RepositoryPath, "TestFile.txt"), Path.Combine(tempDir, "TestFile.txt")); - expectedDynamicRepoLocation = Path.Combine(tempPath, fixture.RepositoryPath.Split(Path.DirectorySeparatorChar).Last()); + expectedDynamicRepoLocation = Path.Combine(tempPath, fixture.RepositoryPath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).Last()); Directory.CreateDirectory(expectedDynamicRepoLocation); var repositoryInfo = new RepositoryInfo @@ -140,7 +140,7 @@ public void PicksAnotherDirectoryNameWhenDynamicRepoFolderTaken() using (var dynamicRepository = DynamicRepositories.CreateOrOpen(repositoryInfo, tempPath, "master", head.Sha)) { - dynamicRepository.Repository.Info.Path.ShouldBe(Path.Combine(expectedDynamicRepoLocation + "_1", ".git\\")); + dynamicRepository.Repository.Info.Path.ShouldBe(Path.Combine(expectedDynamicRepoLocation + "_1", ".git" + Path.DirectorySeparatorChar)); } } } diff --git a/src/GitTools.Core.Tests/Git/GitRepositoryHelperTests.cs b/src/GitTools.Core.Tests/Git/GitRepositoryHelperTests.cs index db79be5..b02e8a2 100644 --- a/src/GitTools.Core.Tests/Git/GitRepositoryHelperTests.cs +++ b/src/GitTools.Core.Tests/Git/GitRepositoryHelperTests.cs @@ -220,7 +220,7 @@ public void GitHubFlowMajorRelease() // fixture.AssertFullSemver("2.0.0"); fixture.MakeACommit(); -#if !NETCOREAPP1_1 +#if !NETCOREAPP2_0 fixture.Repository.DumpGraph(); #endif // fixture.AssertFullSemver("2.0.1+1"); diff --git a/src/GitTools.Core.Tests/GitTools.Core.Tests.csproj b/src/GitTools.Core.Tests/GitTools.Core.Tests.csproj index 509fd05..ce902c6 100644 --- a/src/GitTools.Core.Tests/GitTools.Core.Tests.csproj +++ b/src/GitTools.Core.Tests/GitTools.Core.Tests.csproj @@ -1,48 +1,40 @@  - + Debug - Any CPU + Any CPU Library - net46 - netcoreapp1.1;net46 + netcoreapp2.0;net461 true - full + full ..\..\output\debug\GitTools.Core.Tests\$(TargetFramework)\ - TRACE;DEBUG + TRACE;DEBUG pdbonly true ..\..\output\release\GitTools.Core.Tests\$(TargetFramework)\ - TRACE + TRACE - - - - - - - - - - - + + + + + + + + - - - - - + - - - + + + - - + + \ No newline at end of file diff --git a/src/GitTools.Core.Tests/app.config b/src/GitTools.Core.Tests/app.config deleted file mode 100644 index 364d0b7..0000000 --- a/src/GitTools.Core.Tests/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/GitTools.Core.sln.DotSettings b/src/GitTools.Core.sln.DotSettings index 45c95e3..5cf393b 100644 --- a/src/GitTools.Core.sln.DotSettings +++ b/src/GitTools.Core.sln.DotSettings @@ -28,6 +28,7 @@ False False False + False 20 False @@ -35,6 +36,7 @@ 1 OnSingleLine FirstAttributeOnSingleLine + False <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> <TypePattern Priority="100" DisplayName="Type Pattern"> @@ -446,10 +448,13 @@ II.2.12 <HandlesEvent /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> True + True + True True True True True + True True None <data /> diff --git a/src/GitTools.Core/Git/DynamicRepositories.cs b/src/GitTools.Core/Git/DynamicRepositories.cs index 244c551..ec344ea 100644 --- a/src/GitTools.Core/Git/DynamicRepositories.cs +++ b/src/GitTools.Core/Git/DynamicRepositories.cs @@ -70,7 +70,7 @@ static string GetLockFile(string repoPath) static string GetAndLockTemporaryRepositoryPath(string targetUrl, string dynamicRepositoryLocation) { - var repositoryName = targetUrl.Split('/', '\\').Last().Replace(".git", string.Empty); + var repositoryName = targetUrl.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries).Last().Replace(".git", string.Empty); var possiblePath = Path.Combine(dynamicRepositoryLocation, repositoryName); var i = 1; diff --git a/src/GitTools.Core/Git/Extensions/LibGitExtensions.cs b/src/GitTools.Core/Git/Extensions/LibGitExtensions.cs index 043eed2..bffb5ae 100644 --- a/src/GitTools.Core/Git/Extensions/LibGitExtensions.cs +++ b/src/GitTools.Core/Git/Extensions/LibGitExtensions.cs @@ -150,7 +150,7 @@ public static void CheckoutFilesIfExist(this IRepository repository, params stri } } -#if !NETSTANDARD1_3 +#if !NETSTANDARD2_0 public static void DumpGraph(this IRepository repository, Action writer = null, int? maxCommits = null) { DumpGraph(repository.Info.Path, writer, maxCommits); diff --git a/src/GitTools.Core/GitTools.Core.csproj b/src/GitTools.Core/GitTools.Core.csproj index 174fce8..b2dd02f 100644 --- a/src/GitTools.Core/GitTools.Core.csproj +++ b/src/GitTools.Core/GitTools.Core.csproj @@ -1,8 +1,8 @@  - + Library - netstandard1.3;net45;net40 + netstandard2.0;net461 GitTools.Core @@ -17,43 +17,22 @@ https://raw.github.com/GitTools/GitTools.Core/master/GitTools_logo.png - - TRACE;NET45;NETDESKTOP + + TRACE;NET461;NETDESKTOP - - TRACE;NET40;NETDESKTOP - - - TRACE;LIBLOG_PORTABLE;NETSTANDARD1_3; + + TRACE;LIBLOG_PORTABLE;NETSTANDARD2_0; - - - - - - - - - - - - - - - - - + + + - - - - - - - - - \ No newline at end of file + + + + + diff --git a/src/GitTools.Core/GitTools.Core.nuspec b/src/GitTools.Core/GitTools.Core.nuspec index f85439f..7eb871d 100644 --- a/src/GitTools.Core/GitTools.Core.nuspec +++ b/src/GitTools.Core/GitTools.Core.nuspec @@ -19,11 +19,8 @@ - - - - - - + + + \ No newline at end of file diff --git a/src/GitTools.Core/Helpers/ProcessHelper.cs b/src/GitTools.Core/Helpers/ProcessHelper.cs index 2e57085..46f2b8e 100644 --- a/src/GitTools.Core/Helpers/ProcessHelper.cs +++ b/src/GitTools.Core/Helpers/ProcessHelper.cs @@ -1,6 +1,6 @@ -#if !NETSTANDARD1_3 +#if !NETSTANDARD2_0 namespace GitTools -{ +{ using System; using System.Collections.Generic; using System.ComponentModel; @@ -8,7 +8,7 @@ namespace GitTools using System.IO; using System.Runtime.InteropServices; using System.Threading; - + public static class ProcessHelper {