From 56ed0b22d7f7ab6185f14e0054346da3ca33c4fa Mon Sep 17 00:00:00 2001 From: Mark Probst Date: Wed, 4 Mar 2015 11:32:56 -0800 Subject: Repository state --- repository.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'repository.go') diff --git a/repository.go b/repository.go index 7760c3a..11b0514 100644 --- a/repository.go +++ b/repository.go @@ -630,3 +630,25 @@ func (v *Repository) DefaultNoteRef() (string, error) { return C.GoString(ptr), nil } + +type RepositoryState int + +const ( + RepositoryStateNone RepositoryState = C.GIT_REPOSITORY_STATE_NONE + RepositoryStateMerge RepositoryState = C.GIT_REPOSITORY_STATE_MERGE + RepositoryStateRevert RepositoryState = C.GIT_REPOSITORY_STATE_REVERT + RepositoryStateCherrypick RepositoryState = C.GIT_REPOSITORY_STATE_CHERRYPICK + RepositoryStateBisect RepositoryState = C.GIT_REPOSITORY_STATE_BISECT + RepositoryStateRebase RepositoryState = C.GIT_REPOSITORY_STATE_REBASE + RepositoryStateRebaseInteractive RepositoryState = C.GIT_REPOSITORY_STATE_REBASE_INTERACTIVE + RepositoryStateRebaseMerge RepositoryState = C.GIT_REPOSITORY_STATE_REBASE_MERGE + RepositoryStateApplyMailbox RepositoryState = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX + RepositoryStateApplyMailboxOrRebase RepositoryState = C.GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE +) + +func (r *Repository) State() RepositoryState { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + return RepositoryState(C.git_repository_state(r.ptr)) +} -- cgit v1.2.3