Skip to content

Commit

Permalink
Merge pull request libgit2#432 from josharian/simplify-oid
Browse files Browse the repository at this point in the history
git: simplify some Oid methods
  • Loading branch information
carlosmn authored Jan 3, 2019
2 parents fc1230b + b7ca4a9 commit c740e1d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,16 @@ func (oid *Oid) Cmp(oid2 *Oid) int {
}

func (oid *Oid) Copy() *Oid {
ret := new(Oid)
copy(ret[:], oid[:])
return ret
ret := *oid
return &ret
}

func (oid *Oid) Equal(oid2 *Oid) bool {
return bytes.Equal(oid[:], oid2[:])
return *oid == *oid2
}

func (oid *Oid) IsZero() bool {
for _, a := range oid {
if a != 0 {
return false
}
}
return true
return *oid == Oid{}
}

func (oid *Oid) NCmp(oid2 *Oid, n uint) int {
Expand Down

0 comments on commit c740e1d

Please sign in to comment.