diff options
| author | Patrick Steinhardt <ps@pks.im> | 2015-11-06 12:08:15 +0100 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-02-13 11:04:57 +0100 |
| commit | e3acd37b70dc6d8f1ff256b99a26b4e0f13701ef (patch) | |
| tree | 157985fb3b0c63d4b477e2102af32a25745ac0be /include/git2/branch.h | |
| parent | 4321595dcb83131675c7b38ac7fec8337476026e (diff) | |
| download | libgit2-e3acd37b70dc6d8f1ff256b99a26b4e0f13701ef.tar.gz | |
branch: implement `git_branch_is_checked_out`
Implement a new function that is able to determine if a branch is
checked out in any repository connected to the current
repository. In particular, this is required to check if for a
given repository and branch, there exists any working tree
connected to that repository that is referencing this branch.
Diffstat (limited to 'include/git2/branch.h')
| -rw-r--r-- | include/git2/branch.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/git2/branch.h b/include/git2/branch.h index 34354f4e5..88fe723a0 100644 --- a/include/git2/branch.h +++ b/include/git2/branch.h @@ -246,6 +246,18 @@ GIT_EXTERN(int) git_branch_is_head( const git_reference *branch); /** + * Determine if the current branch is checked out in any linked + * repository. + * + * @param branch Reference to the branch. + * + * @return 1 if branch is checked out, 0 if it isn't, + * error code otherwise. + */ +GIT_EXTERN(int) git_branch_is_checked_out( + const git_reference *branch); + +/** * Return the name of remote that the remote tracking branch belongs to. * * @param out Pointer to the user-allocated git_buf which will be filled with the name of the remote. |
