@@ -924,16 +924,24 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
924924
925925 if id != "" {
926926 // Check if the item on the previous still exists. In this case it might have been a copy with extended attributes -> set new ID
927+ isCopy := false
927928 previousPath , ok := t .lookup .GetCachedID (context .Background (), spaceID , id )
928929 if ok && previousPath != path {
929- // this id clashes with an existing id -> re-assimilate
930930 _ , err := os .Stat (previousPath )
931931 if err == nil {
932- _ = t .assimilate (scanItem {Path : path , Trigger : "warmup id cache - id clash" })
932+ // previous path still exists -> this is a copy
933+ isCopy = true
933934 }
934935 }
935- if err := t .lookup .CacheID (context .Background (), spaceID , id , path ); err != nil {
936- t .log .Error ().Err (err ).Str ("spaceID" , spaceID ).Str ("id" , id ).Str ("path" , path ).Msg ("could not cache id" )
936+ if isCopy {
937+ // copy detected -> re-assimilate
938+ _ = t .assimilate (scanItem {Path : path , Trigger : "warmup id cache - id clash, previous path: " + previousPath })
939+ } else {
940+ // update cache with new path
941+ t .log .Debug ().Str ("path" , path ).Str ("id" , id ).Msg ("caching id" )
942+ if err := t .lookup .CacheID (context .Background (), spaceID , id , path ); err != nil {
943+ t .log .Error ().Err (err ).Str ("spaceID" , spaceID ).Str ("id" , id ).Str ("path" , path ).Msg ("could not cache id" )
944+ }
937945 }
938946 }
939947 } else if assimilate {
0 commit comments