File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -205,9 +205,11 @@ int error = git_repository_open_bare(&repo, "/var/data/…/repo.git");
205
205
<h3 id=" repositories_openable" >Is Directory A Repository?</h3>
206
206
207
207
```c
208
- /* Pass NULL for the output parameter to not open the repo immediately */
209
- int error = git_repository_open_ext(
210
- NULL, " /tmp/…" , GIT_REPOSITORY_OPEN_NO_SEARCH, NULL);
208
+ /* Pass NULL for the output parameter to check for but not open the repo */
209
+ if (git_repository_open_ext(
210
+ NULL, " /tmp/…" , GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) == 0) {
211
+ /* directory looks like an openable repository */;
212
+ }
211
213
```
212
214
213
215
([`git_repository_open_ext`](http://libgit2.github.com/libgit2/#HEAD/group/repository/git_repository_open_ext),
You can’t perform that action at this time.
0 commit comments