Skip to content

Commit 86b532d

Browse files
committed
Correct the definition of "empty" in the docs for git_repository_is_empty
This improves the documentation for `git_repository_is_empty` which currently does not accurately describe libgit2's definition of "empty". It says that HEAD must point to the "unborn master branch", when in fact, this is not the case if the repo's `init.defaultBranch` configuration is set. If it is set, it will check that HEAD points there. Only if it is not set does it fall back to `master`.
1 parent 6f2eedb commit 86b532d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

include/git2/repository.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,9 @@ GIT_EXTERN(int) git_repository_head_unborn(git_repository *repo);
465465
* Check if a repository is empty
466466
*
467467
* An empty repository has just been initialized and contains no references
468-
* apart from HEAD, which must be pointing to the unborn master branch.
468+
* apart from HEAD, which must be pointing to the unborn master branch,
469+
* or the branch specified for the repository in the `init.defaultBranch`
470+
* configuration variable.
469471
*
470472
* @param repo Repo to test
471473
* @return 1 if the repository is empty, 0 if it isn't, error code

0 commit comments

Comments
 (0)