From 1c3910befbe8d6679979ac43b00796ea58329dff Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 14 Jul 2021 02:25:12 +0200 Subject: reduce: fix off-by-one error duplication detection required a +1 on the index in the ref document --- skate/reduce.go | 2 +- skate/reduce_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'skate') diff --git a/skate/reduce.go b/skate/reduce.go index eac2e83..01df50f 100644 --- a/skate/reduce.go +++ b/skate/reduce.go @@ -501,7 +501,7 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [ seen.Add(s) } for _, r := range refs { - s := r.Key + fmt.Sprintf("%d", r.Index) + s := r.Key + fmt.Sprintf("%d", r.Index+1) if seen.Contains(s) { stats.skipMatchedRef++ log.Printf("skip-matched-ref [%d]: from %d matches; ident=%v, title=%s, key=%v, index=%d", diff --git a/skate/reduce_test.go b/skate/reduce_test.go index 99c0ed7..da4e21e 100644 --- a/skate/reduce_test.go +++ b/skate/reduce_test.go @@ -215,7 +215,7 @@ func TestMatchedRefsExtend(t *testing.T) { Biblio: Biblio{ Title: "Title", }, - Index: 2, + Index: 1, Key: "K2", }, }, -- cgit v1.2.3