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

Closed
yishaigalatzer opened this Issue Feb 22, 2013 · 1 comment

2 participants

@yishaigalatzer

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 nulltoken added a commit that closed this issue Mar 1, 2013
@nulltoken nulltoken Throws when HEAD is missing
Fix #351
3e65630
@nulltoken nulltoken closed this in 3e65630 Mar 1, 2013
@nulltoken
libgit2 member

@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