8

I've started using LibGit2Sharp in my project and I have to admit its pretty awesome. I'm glad i didnt go the command line route with processinfo. But I have a question which I couldn't find an answer for in the wiki and could not find a test in the source code that had it. How can you check with LibGit2Sharp if a folder is a git repository?

wendellmva
  • 1,896
  • 1
  • 26
  • 33

1 Answers1

10

You can call Repository.IsValid(path). The source code for Repository is here.

The path can be either to the .git folder or to the working directory.

Matze
  • 5,100
  • 6
  • 46
  • 69
Matthew Strawbridge
  • 19,940
  • 10
  • 72
  • 93