public void GetHashCodeTest() { var commit = new GitCommit() { Sha = GitObjectId.Parse(this.shaAsByteArray), }; var emptyCommit = new GitCommit() { Sha = GitObjectId.Empty, }; // The hash code is the int32 representation of the first 4 bytes of the SHA hash Assert.Equal(0x3627914e, commit.GetHashCode()); Assert.Equal(0, emptyCommit.GetHashCode()); }
public override int GetHashCode() { int hash = 1; if (SemVer.Length != 0) { hash ^= SemVer.GetHashCode(); } if (GitCommit.Length != 0) { hash ^= GitCommit.GetHashCode(); } if (GitTreeState.Length != 0) { hash ^= GitTreeState.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <inheritdoc /> public override int GetHashCode() { return(GitCommit != null?GitCommit.GetHashCode() : 0); }