aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorvince <vincetiu8@gmail.com>2020-07-26 15:52:29 +0800
committervince <vincetiu8@gmail.com>2020-08-20 14:06:18 +0800
commit6efada43e73c40e0c76c441f84cf02cc00d3eb1b (patch)
treeae1aef821a8447d299ad9d1afc25809f4ccde3f8 /bug
parent88c28db99851e7f5cceed6544759d37ac87a34d4 (diff)
downloadgit-bug-6efada43e73c40e0c76c441f84cf02cc00d3eb1b.tar.gz
Implement the LRU Cache
Diffstat (limited to 'bug')
-rw-r--r--bug/bug.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/bug/bug.go b/bug/bug.go
index 2ee89031..3a770881 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -749,3 +749,22 @@ func (bug *Bug) Compile() Snapshot {
return snap
}
+
+// EquivalentBug returns true if two bugs are equal
+func EquivalentBug(expected, actual *Bug) bool {
+ if len(expected.packs) != len(actual.packs) {
+ return false
+ }
+
+ for i := range expected.packs {
+ for j := range expected.packs[i].Operations {
+ actual.packs[i].Operations[j].base().id = expected.packs[i].Operations[j].base().id
+ }
+ }
+
+ if expected != actual {
+ return false
+ }
+
+ return true
+}