Skip to content

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

Closed
@yishaigalatzer

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions