Skip to content

Commit a9fe028

Browse files
committed
Clarify repository_open_ext with NULL out example
1 parent 39ae3d4 commit a9fe028

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/guides/101-samples/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ int error = git_repository_open_bare(&repo, "/var/data/…/repo.git");
205205
<h3 id="repositories_openable">Is Directory A Repository?</h3>
206206
207207
```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+
}
211213
```
212214
213215
([`git_repository_open_ext`](http://libgit2.github.com/libgit2/#HEAD/group/repository/git_repository_open_ext),

0 commit comments

Comments
 (0)