diff options
| author | Carlos MartÃn Nieto <[email protected]> | 2017-01-20 22:55:25 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-01-20 22:55:25 +0000 |
| commit | 4a14260153072e1e0d8e32d9270b30e3acca7c80 (patch) | |
| tree | 112c3a1f75c2fcc8d3e88f1d0c6687de179e3ac3 /repository.go | |
| parent | b8a9efd21f5ea094976ff2c53c4aec1cf6014876 (diff) | |
| parent | b020c1140a2cb8be18141498a6cab5440409dc24 (diff) | |
Merge pull request #362 from libgit2/cmn/master-tip-static
Update master to latest libgit2 and build statically
Diffstat (limited to 'repository.go')
| -rw-r--r-- | repository.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/repository.go b/repository.go index efc506e..0612b5f 100644 --- a/repository.go +++ b/repository.go @@ -30,6 +30,9 @@ type Repository struct { // Tags represents the collection of tags and can be used to create, // list, iterate and remove tags in this repository. Tags TagsCollection + // Stashes represents the collection of stashes and can be used to + // save, apply and iterate over stash states in this repository. + Stashes StashCollection } func newRepositoryFromC(ptr *C.git_repository) *Repository { @@ -40,6 +43,7 @@ func newRepositoryFromC(ptr *C.git_repository) *Repository { repo.References.repo = repo repo.Notes.repo = repo repo.Tags.repo = repo + repo.Stashes.repo = repo runtime.SetFinalizer(repo, (*Repository).Free) @@ -264,6 +268,40 @@ func (v *Repository) IsHeadDetached() (bool, error) { return ret != 0, nil } +func (v *Repository) IsHeadUnborn() (bool, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_repository_head_unborn(v.ptr) + if ret < 0 { + return false, MakeGitError(ret) + } + return ret != 0, nil +} + +func (v *Repository) IsEmpty() (bool, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_repository_is_empty(v.ptr) + if ret < 0 { + return false, MakeGitError(ret) + } + + return ret != 0, nil +} + +func (v *Repository) IsShallow() (bool, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + ret := C.git_repository_is_shallow(v.ptr) + if ret < 0 { + return false, MakeGitError(ret) + } + return ret != 0, nil +} + func (v *Repository) Walk() (*RevWalk, error) { var walkPtr *C.git_revwalk |
