summaryrefslogtreecommitdiff
path: root/reference.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-02-26 14:51:04 +0100
committerCarlos Martín Nieto <[email protected]>2014-02-26 14:51:04 +0100
commitca2c3c6db287f469736ff635167cd54f29b8a067 (patch)
tree43a7e034fc0ea40cbe91e98c8badd91b375da36d /reference.go
parent786393a380e17e1e0bc47fea97cbe18c8c0ebb22 (diff)
Add a few reference utility functions
Diffstat (limited to 'reference.go')
-rw-r--r--reference.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/reference.go b/reference.go
index a2f1636..4a839a7 100644
--- a/reference.go
+++ b/reference.go
@@ -134,6 +134,17 @@ func (v *Reference) Delete() error {
return nil
}
+// Cmp compares both references, retursn 0 on equality, otherwise a
+// stable sorting.
+func (v *Reference) Cmp(ref2 *Reference) int {
+ return int(C.git_reference_cmp(v.ptr, ref2.ptr))
+}
+
+// Shorthand returns a "human-readable" short reference name
+func (v *Reference) Shorthand() string {
+ return C.GoString(C.git_reference_shorthand(v.ptr))
+}
+
func (v *Reference) Name() string {
return C.GoString(C.git_reference_name(v.ptr))
}