Oid: fix IsZero()

We need to compare against the number zero, not its ASCII value.
This commit is contained in:
Carlos Martín Nieto 2014-03-19 03:51:59 +01:00
parent 0bb73e43a8
commit b82a72a9ce
2 changed files with 9 additions and 1 deletions

2
git.go
View File

@ -88,7 +88,7 @@ func (oid *Oid) Equal(oid2 *Oid) bool {
func (oid *Oid) IsZero() bool {
for _, a := range oid {
if a != '0' {
if a != 0 {
return false
}
}

View File

@ -54,3 +54,11 @@ func seedTestRepo(t *testing.T, repo *Repository) (*Oid, *Oid) {
return commitId, treeId
}
func TestOidZero(t *testing.T) {
var zeroId Oid
if !zeroId.IsZero() {
t.Error("Zero Oid is not zero")
}
}