From d6cfe857b716022eec4fd80f859341ec977010c8 Mon Sep 17 00:00:00 2001
From: Michael Eischer <michael.eischer@fau.de>
Date: Sun, 9 Aug 2020 13:26:07 +0200
Subject: [PATCH] pass proper context into MasterIndex.RebuildIndex

---
 internal/repository/master_index.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/internal/repository/master_index.go b/internal/repository/master_index.go
index 57b2985a6..6f19a0aad 100644
--- a/internal/repository/master_index.go
+++ b/internal/repository/master_index.go
@@ -267,7 +267,7 @@ func (mi *MasterIndex) MergeFinalIndexes() {
 // RebuildIndex combines all known indexes to a new index, leaving out any
 // packs whose ID is contained in packBlacklist. The new index contains the IDs
 // of all known indexes in the "supersedes" field.
-func (mi *MasterIndex) RebuildIndex(packBlacklist restic.IDSet) (*Index, error) {
+func (mi *MasterIndex) RebuildIndex(ctx context.Context, packBlacklist restic.IDSet) (*Index, error) {
 	mi.idxMutex.Lock()
 	defer mi.idxMutex.Unlock()
 
@@ -275,7 +275,7 @@ func (mi *MasterIndex) RebuildIndex(packBlacklist restic.IDSet) (*Index, error)
 
 	newIndex := NewIndex()
 
-	ctx, cancel := context.WithCancel(context.TODO())
+	ctx, cancel := context.WithCancel(ctx)
 	defer cancel()
 
 	for i, idx := range mi.idx {