diff options
| author | Vicent Martà <tanoku@gmail.com> | 2011-06-28 10:44:19 -0700 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2011-06-28 10:44:19 -0700 |
| commit | ccd59372d46759a92c8197717ca02ba0eb31b7be (patch) | |
| tree | 9874e7a48cd3a18dca32f10d1555fde3044cd544 /include | |
| parent | 9525e47df91c42922b5bbcd1a1408899c5dc89be (diff) | |
| parent | f5e09d608062d46b773a72113656b39053e09a7f (diff) | |
| download | libgit2-ccd59372d46759a92c8197717ca02ba0eb31b7be.tar.gz | |
Merge pull request #279 from carlosmn/detached-orphan
Add detached and orphan convenience functions
Diffstat (limited to 'include')
| -rw-r--r-- | include/git2/repository.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index 27c3138f7..ddadab4da 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -219,6 +219,30 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo); GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path, unsigned is_bare); /** + * Check if a repository's HEAD is detached + * + * A repository's HEAD is detached when it points directly to a commit + * instead of a branch. + * + * @param repo Repo to test + * @return 1 if HEAD is detached, 0 if i'ts not; error code if there + * was an error. + */ +int git_repository_is_detached(git_repository *repo); + +/** + * Check if the current branch is an orphan + * + * An orphan branch is one named from HEAD but which doesn't exist in + * the refs namespace, because it doesn't have any commit to point to. + * + * @param repo Repo to test + * @return 1 if the current branch is an orphan, 0 if it's not; error + * code if therewas an error + */ +int git_repository_is_orphan(git_repository *repo); + +/** * Check if a repository is empty * * An empty repository has just been initialized and contains |
