File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package git
7
7
*/
8
8
import "C"
9
9
import (
10
+ "bytes"
10
11
"unsafe"
11
12
)
12
13
@@ -67,6 +68,33 @@ func (oid *Oid) Bytes() []byte {
67
68
return oid .bytes [0 :]
68
69
}
69
70
71
+ func (oid * Oid ) Cmp (oid2 * Oid ) int {
72
+ return bytes .Compare (oid .bytes [:], oid2 .bytes [:])
73
+ }
74
+
75
+ func (oid * Oid ) Copy () * Oid {
76
+ ret := new (Oid )
77
+ copy (ret .bytes [:], oid .bytes [:])
78
+ return ret
79
+ }
80
+
81
+ func (oid * Oid ) Equal (oid2 * Oid ) bool {
82
+ return bytes .Equal (oid .bytes [:], oid2 .bytes [:])
83
+ }
84
+
85
+ func (oid * Oid ) IsZero () bool {
86
+ for _ , a := range (oid .bytes ) {
87
+ if a != '0' {
88
+ return false
89
+ }
90
+ }
91
+ return true
92
+ }
93
+
94
+ func (oid * Oid ) NCmp (oid2 * Oid , n uint ) int {
95
+ return bytes .Compare (oid .bytes [:n ], oid2 .bytes [:n ])
96
+ }
97
+
70
98
type GitError struct {
71
99
Message string
72
100
Code int
You can’t perform that action at this time.
0 commit comments