setPlatformData makes adjustments to the metadata that should happen for all types (files, directories, symlinks). This should be one of the last things we do to a file when syncing changes to it.
(file *protocol.FileInfo, name string)
| 2152 | // all types (files, directories, symlinks). This should be one of the last |
| 2153 | // things we do to a file when syncing changes to it. |
| 2154 | func (f *sendReceiveFolder) setPlatformData(file *protocol.FileInfo, name string) error { |
| 2155 | if f.SyncXattrs { |
| 2156 | // Set extended attributes. |
| 2157 | if err := f.mtimefs.SetXattr(name, file.Platform.Xattrs(), f.XattrFilter); errors.Is(err, fs.ErrXattrsNotSupported) { |
| 2158 | f.sl.Debug("Cannot set xattrs (not supported)", slogutil.FilePath(file.Name), slogutil.Error(err)) |
| 2159 | } else if err != nil { |
| 2160 | return err |
| 2161 | } |
| 2162 | } |
| 2163 | |
| 2164 | if f.SyncOwnership { |
| 2165 | // Set ownership based on file metadata. |
| 2166 | if err := f.syncOwnership(file, name); err != nil { |
| 2167 | return err |
| 2168 | } |
| 2169 | } else if f.CopyOwnershipFromParent { |
| 2170 | // Copy the parent owner and group. |
| 2171 | if err := f.copyOwnershipFromParent(name); err != nil { |
| 2172 | return err |
| 2173 | } |
| 2174 | } |
| 2175 | |
| 2176 | return nil |
| 2177 | } |
| 2178 | |
| 2179 | func (f *sendReceiveFolder) copyOwnershipFromParent(path string) error { |
| 2180 | if build.IsWindows { |