Skip to content
This repository

Head throws unexpected exception when the .git folder is deleted. #351

Closed
yishaigalatzer opened this Issue · 1 comment

2 participants

Yishai Galatzer nulltoken
Yishai Galatzer

All through lg2#

Create a folder
Call init
Delete the .git folder
Call repo.Head

Expected: Libgit2sharp exception
Got: ArgumentNullException

See attached callstack
System.ArgumentNullException: Value cannot be null.
Parameter name: reference
at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName)
at LibGit2Sharp.ReferenceWrapper1..ctor(Repository repo, Reference reference, Func2 canonicalNameSelector)
at LibGit2Sharp.Branch..ctor(Repository repo, Reference reference, Func`2 canonicalNameSelector)
at LibGit2Sharp.Branch..ctor(Repository repo, Reference reference, String canonicalName)
at LibGit2Sharp.DetachedHead..ctor(Repository repo, Reference reference)
at LibGit2Sharp.Repository.get_Head()
--> My call

nulltoken
Collaborator

@yishaigalatzer A fix for this issue has been pushed.

However, rather than checking for the complete removal of the .git directory, the test focuses on the removal of the HEAD symref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.