diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d487a49aa..e1c1ab31d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ But first things first... * Make sure you fill in the earliest version that you know has the issue. * Fork the repository on GitHub, then clone it using your favorite Git client. * Make sure the project builds and all tests pass on your machine by running - the `build.libgit2sharp.cmd` script on Windows or `build.libgit2sharp.sh` on Linux/Mac. + the `buildandtest.cmd` script on Windows or `buildandtest.sh` on Linux/Mac. ## LibGit2 @@ -48,4 +48,4 @@ Some things that will increase the chance that your pull request is accepted. # Additional Resources * [General GitHub documentation](http://help.github.com/) -* [GitHub pull request documentation](https://help.github.com/articles/using-pull-requests/) \ No newline at end of file +* [GitHub pull request documentation](https://help.github.com/articles/using-pull-requests/) diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs index d8a47edfb..736b0faec 100644 --- a/LibGit2Sharp.Tests/BranchFixture.cs +++ b/LibGit2Sharp.Tests/BranchFixture.cs @@ -51,6 +51,19 @@ public void CanCreateBranch(string name) } } + [Theory] + [InlineData("32eab9cb1f450b5fe7ab663462b77d7f4b703344")] + public void CanHeadBeDetached(string commit) + { + string path = SandboxStandardTestRepo(); + using (var repo = new Repository(path)) + { + Assert.False(repo.Info.IsHeadDetached); + Commands.Checkout(repo, commit); + Assert.True(repo.Info.IsHeadDetached); + } + } + [Fact] public void CanCreateAnUnbornBranch() { diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 68ea2cfd0..77259ae1b 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -25,6 +25,12 @@ + + + PreserveNewest + + + <_TestAppFile Include="@(TestAppExe->'%(RootDir)%(Directory)%(Filename).exe')" /> diff --git a/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs b/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs index c93c55c5f..dc2552a10 100644 --- a/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs +++ b/LibGit2Sharp.Tests/PatchEntryChangesFixture.cs @@ -23,7 +23,7 @@ public void PatchEntryBasics() Tree rootCommitTree = repo.Lookup("f8d44d7").Tree; Tree commitTreeWithUpdatedFile = repo.Lookup("ec9e401").Tree; - // Create path by diffing + // Create patch by diffing using (var patch = repo.Diff.Compare(rootCommitTree, commitTreeWithUpdatedFile)) { PatchEntryChanges entryChanges = patch[file]; diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs index d15462b83..a61d920dc 100644 --- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs +++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs @@ -65,10 +65,7 @@ private static void SetUpTestEnvironment() if (resourcesPath == null) { - string initialAssemblyParentFolder = Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName; - const string sourceRelativePath = @"../../../../LibGit2Sharp.Tests/Resources"; - - resourcesPath = Path.Combine(initialAssemblyParentFolder, sourceRelativePath); + resourcesPath = Path.Combine(Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName, "Resources"); } ResourcesDirectory = new DirectoryInfo(resourcesPath); diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 2e376e2c0..74fdb4903 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -36,7 +36,7 @@ - + diff --git a/buildandtest.sh b/buildandtest.sh index 47e5e1053..a5501a042 100755 --- a/buildandtest.sh +++ b/buildandtest.sh @@ -15,7 +15,7 @@ export Configuration=release # On linux we don't pack because we can't build for net40. # We just build for CoreCLR and run tests for it. dotnet restore -dotnet build LibGit2Sharp.Tests -f netcoreapp2.0 /property:ExtraDefine="$EXTRADEFINE" /fl /flp:verbosity=detailed +dotnet build LibGit2Sharp.Tests -f netcoreapp2.0 -property:ExtraDefine="$EXTRADEFINE" -fl -flp:verbosity=detailed dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp2.0 --no-restore --no-build exit $?