diff --git a/src/internal/connector/onedrive/collections.go b/src/internal/connector/onedrive/collections.go index a5adb9d34..b8c8b9c48 100644 --- a/src/internal/connector/onedrive/collections.go +++ b/src/internal/connector/onedrive/collections.go @@ -359,7 +359,7 @@ func (c *Collections) Get( } // TODO(ashmrtn): Track and return the set of items to exclude. - return collections, nil, nil + return collections, excludedItems, nil } // UpdateCollections initializes and adds the provided drive items to Collections diff --git a/src/internal/connector/onedrive/collections_test.go b/src/internal/connector/onedrive/collections_test.go index 7b81a5b74..0b10d02bd 100644 --- a/src/internal/connector/onedrive/collections_test.go +++ b/src/internal/connector/onedrive/collections_test.go @@ -1387,7 +1387,7 @@ func (suite *OneDriveCollectionsSuite) TestGet() { c.itemPagerFunc = itemPagerFunc // TODO(ashmrtn): Allow passing previous metadata. - cols, _, err := c.Get(ctx, nil) + cols, delList, err := c.Get(ctx, nil) test.errCheck(t, err) if err != nil { @@ -1424,9 +1424,7 @@ func (suite *OneDriveCollectionsSuite) TestGet() { assert.ElementsMatch(t, test.expectedCollections[folderPath], itemIDs) } - // TODO(ashmrtn): Uncomment this when we begin return the set of items to - // remove from the upcoming backup. - // assert.Equal(t, test.expectedDelList, delList) + assert.Equal(t, test.expectedDelList, delList) }) } } diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index ec47bae1c..31912585f 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -243,7 +243,7 @@ func (op *BackupOperation) do( return nil, errors.Wrap(err, "connectng to m365") } - cs, err := produceBackupDataCollections(ctx, gc, op.Selectors, mdColls, op.Options) + cs, excludes, err := produceBackupDataCollections(ctx, gc, op.Selectors, mdColls, op.Options) if err != nil { return nil, errors.Wrap(err, "producing backup data collections") } @@ -257,6 +257,7 @@ func (op *BackupOperation) do( reasons, mans, cs, + excludes, backupID, op.incremental && canUseMetaData) if err != nil { @@ -309,7 +310,7 @@ func produceBackupDataCollections( sel selectors.Selector, metadata []data.Collection, ctrlOpts control.Options, -) ([]data.Collection, error) { +) ([]data.Collection, map[string]struct{}, error) { complete, closer := observe.MessageWithCompletion(ctx, observe.Safe("Discovering items to backup")) defer func() { complete <- struct{}{} @@ -317,11 +318,9 @@ func produceBackupDataCollections( closer() }() - // TODO(ashmrtn): When we're ready to wire up the global exclude list return - // all values. - cols, _, errs := gc.DataCollections(ctx, sel, metadata, ctrlOpts) + cols, excludes, errs := gc.DataCollections(ctx, sel, metadata, ctrlOpts) - return cols, errs + return cols, excludes, errs } // --------------------------------------------------------------------------- @@ -391,6 +390,7 @@ func consumeBackupDataCollections( reasons []kopia.Reason, mans []*kopia.ManifestEntry, cs []data.Collection, + excludes map[string]struct{}, backupID model.StableID, isIncremental bool, ) (*kopia.BackupStats, *details.Builder, map[string]path.Path, error) { @@ -456,6 +456,8 @@ func consumeBackupDataCollections( ctx, bases, cs, + // TODO(ashmrtn): When we're ready to enable incremental backups for + // OneDrive replace this with `excludes`. nil, tags, isIncremental) diff --git a/src/internal/operations/backup_test.go b/src/internal/operations/backup_test.go index 149448e66..4adc70b30 100644 --- a/src/internal/operations/backup_test.go +++ b/src/internal/operations/backup_test.go @@ -575,6 +575,7 @@ func (suite *BackupOpSuite) TestBackupOperation_ConsumeBackupDataCollections_Pat nil, test.inputMan, nil, + nil, model.StableID(""), true, )