MCPcopy Create free account
hub / github.com/go-git/go-git / diffTreeIsEquals

Function diffTreeIsEquals

worktree_status.go:255–264  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
255func 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

Callers

nothing calls this directly

Calls 1

HashMethod · 0.65

Tested by

no test coverage detected