diff --git a/src/internal/kopia/upload.go b/src/internal/kopia/upload.go index 9fc987eb0..f44a4c69d 100644 --- a/src/internal/kopia/upload.go +++ b/src/internal/kopia/upload.go @@ -756,7 +756,8 @@ func traverseBaseDir( // in the node. That allows us to propagate subtree operations (e.x. move) // while selectively skipping merging old and new versions for some // directories. The expected usecase for this is delta token expiry in M365. - if node.collection != nil && node.collection.DoNotMergeItems() { + if node.collection != nil && + (node.collection.DoNotMergeItems() || node.collection.State() == data.NewState) { return nil } diff --git a/src/internal/kopia/upload_test.go b/src/internal/kopia/upload_test.go index 90462f375..c382bb8ca 100644 --- a/src/internal/kopia/upload_test.go +++ b/src/internal/kopia/upload_test.go @@ -1148,6 +1148,37 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() { }, ), }, + { + name: "NewDoesntMerge", + inputCollections: func() []data.Collection { + mc1 := mockconnector.NewMockExchangeCollection(dirPath, 1) + mc1.ColState = data.NewState + mc1.Names[0] = testFileName2 + mc1.Data[0] = testFileData2 + + return []data.Collection{mc1} + }, + expected: expectedTreeWithChildren( + []string{ + testTenant, + service, + testUser, + category, + }, + []*expectedNode{ + { + name: testInboxDir, + children: []*expectedNode{ + { + name: testFileName2, + children: []*expectedNode{}, + data: testFileData2, + }, + }, + }, + }, + ), + }, } for _, test := range table {