diffTreeIsEquals is a implementation of noder.Equals, used to compare noder.Noder, it compare the content and the length of the hashes. Since some of the noder.Noder implementations doesn't compute a hash for some directories, if any of the hashes is a 24-byte slice of zero values the comparison is
(a, b noder.Hasher)
| 253 | // some directories, if any of the hashes is a 24-byte slice of zero values |
| 254 | // the comparison is not done and the hashes are take as different. |
| 255 | func diffTreeIsEquals(a, b noder.Hasher) bool { |
| 256 | hashA := a.Hash() |
| 257 | hashB := b.Hash() |
| 258 | |
| 259 | if bytes.Equal(hashA, emptyNoderHash) || bytes.Equal(hashB, emptyNoderHash) { |
| 260 | return false |
| 261 | } |
| 262 | |
| 263 | return bytes.Equal(hashA, hashB) |
| 264 | } |
| 265 | |
| 266 | // Add adds the file contents of a file in the worktree to the index. if the |
| 267 | // file is already staged in the index no error is returned. If a file deleted |