summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
authorJesse Ezell <[email protected]>2014-03-26 11:18:21 -0700
committerJesse Ezell <[email protected]>2014-03-26 11:18:21 -0700
commit85420f2002ae85b2e86b3c37c04e462c1cef462a (patch)
tree943fd6fef1b14db9bd6818d4b14243e6d3641b1d /index.go
parent8ad5cbc53763ca8e89ede40f91edab80c8def1f1 (diff)
parent2811845a1287d949a74b8ed80a5791fd8875002a (diff)
Merge branch 'master' of http://github.com/libgit2/git2go into merge
Diffstat (limited to 'index.go')
-rw-r--r--index.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/index.go b/index.go
index 6da3c98..7336249 100644
--- a/index.go
+++ b/index.go
@@ -23,7 +23,7 @@ type IndexEntry struct {
Uid uint
Gid uint
Size uint
- Id *Oid
+ Id *Oid
Path string
}
@@ -48,6 +48,20 @@ func (v *Index) AddByPath(path string) error {
return nil
}
+func (v *Index) WriteTreeTo(repo *Repository) (*Oid, error) {
+ oid := new(Oid)
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ret := C.git_index_write_tree_to(oid.toC(), v.ptr, repo.ptr)
+ if ret < 0 {
+ return nil, MakeGitError(ret)
+ }
+
+ return oid, nil
+}
+
func (v *Index) WriteTree() (*Oid, error) {
oid := new(Oid)
@@ -62,7 +76,7 @@ func (v *Index) WriteTree() (*Oid, error) {
return oid, nil
}
-func (v *Index) Write() (error) {
+func (v *Index) Write() error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()