gitlib icon indicating copy to clipboard operation
gitlib copied to clipboard

How to detect if something is a repo

Open nomeata opened this issue 10 years ago • 1 comments

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

nomeata avatar May 17 '15 09:05 nomeata

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.

jwiegley avatar Jun 10 '15 16:06 jwiegley