From 24074779c1a52c2c0932828d2a8b67cf6db9e403 Mon Sep 17 00:00:00 2001 From: Paolo Viotti Date: Fri, 2 Nov 2018 16:40:05 +0000 Subject: [PATCH] add CanHeadBeDetached; close #1116 --- LibGit2Sharp.Tests/BranchFixture.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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() {