jwiegley / gitlib

180 stars 56 forks source link

How to detect if something is a repo #47

Open nomeata opened 9 years ago

nomeata commented 9 years ago

Hi,

I’d like to check if a given directory is a git repository, and if so, if it is a bare repository. Can do I do that using gitlib / gitlib-libgit2?

Thanks, Joachim

jwiegley commented 9 years ago

Hi @nomeata! You could try to open it as a repository and see if it fails, but other than that, I'd use regular filesystem features as you might in a shell script.