MCPcopy
hub / github.com/opencloud-eu/opencloud / setAllParentIDAttributes

Function setAllParentIDAttributes

opencloud/pkg/command/posixfs.go:444–467  ·  view source on GitHub ↗
(entries []EntryInfo, targetID string)

Source from the content-addressed store, hash-verified

442}
443
444func setAllParentIDAttributes(entries []EntryInfo, targetID string) error {
445 fmt.Printf(" Setting all parent IDs to '%s':\n", targetID)
446
447 for _, entry := range entries {
448 if entry.ParentID == targetID {
449 fmt.Printf(" - Skipping '%s' (already has target ID).\n", filepath.Base(entry.Path))
450 continue
451 }
452
453 fmt.Printf(" - Removing all attributes from '%s'. It will be re-assimilated\n", filepath.Base(entry.Path))
454 filepath.WalkDir(entry.Path, func(path string, d os.DirEntry, err error) error {
455 if err != nil {
456 return fmt.Errorf("error walking path '%s': %w", path, err)
457 }
458
459 // Remove all attributes from the file.
460 if err := removeAttributes(path); err != nil {
461 fmt.Printf("failed to remove attributes from '%s': %v", path, err)
462 }
463 return nil
464 })
465 }
466 return nil
467}
468
469// updateOwnerIndexFile handles the logic of reading, modifying, and writing the MessagePack index file.
470func updateOwnerIndexFile(basePath string, obsoleteIDs []string) error {

Callers 1

fixSpaceIDFunction · 0.85

Calls 2

removeAttributesFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected