summaryrefslogtreecommitdiff
path: root/object.go
diff options
context:
space:
mode:
Diffstat (limited to 'object.go')
-rw-r--r--object.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/object.go b/object.go
index 1981980..b365a3f 100644
--- a/object.go
+++ b/object.go
@@ -49,6 +49,20 @@ func (o *Object) Id() *Oid {
return newOidFromC(C.git_object_id(o.ptr))
}
+func (o *Object) ShortId() (string, error) {
+ resultBuf := C.git_buf{}
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
+ ecode := C.git_object_short_id(&resultBuf, o.ptr)
+ if ecode < 0 {
+ return "", MakeGitError(ecode)
+ }
+ defer C.git_buf_free(&resultBuf)
+ return C.GoString(resultBuf.ptr), nil
+}
+
func (o *Object) Type() ObjectType {
return ObjectType(C.git_object_type(o.ptr))
}