Closed
Description
Ok, this is admittedly an edge case, but I thought I'd bring it up.
If you create a brand new repository, this property:
repo.Head.IsCurrentRepositoryHead
throws a NullReferenceException
when you evaluate it.
To demonstrate the issue, I updated the test CanCreateBareRepo
test, line 15 of RepositoryFixture, with two additional asserts.
repo.Head.CanonicalName.ShouldEqual("refs/heads/master");
repo.Head.IsCurrentRepositoryHead.ShouldBeTrue();
That second line throws a NullReferenceException
when added to the existing unit test.
My guess is that:
repo.Head.IsCurrentRepositoryHead.ShouldBeTrue();
Should probably return true.
Though you could also argue that this is an invalid operation because there are no commits yet so refs/heads/master
doesn't yet exist. But in that case, I still think an InvalidOperationException
would be better than NulReferenceException
. 😃
Metadata
Metadata
Assignees
Labels
No labels