MCPcopy
hub / github.com/syncthing/syncthing / setIgnores

Method setIgnores

lib/model/model.go:2235–2259  ·  view source on GitHub ↗
(cfg config.FolderConfiguration, content []string)

Source from the content-addressed store, hash-verified

2233}
2234
2235func (m *model) setIgnores(cfg config.FolderConfiguration, content []string) error {
2236 err := cfg.CheckPath()
2237 if errors.Is(err, config.ErrPathMissing) {
2238 if err = cfg.CreateRoot(); err != nil {
2239 return fmt.Errorf("failed to create folder root: %w", err)
2240 }
2241 err = cfg.CheckPath()
2242 }
2243 if err != nil && !errors.Is(err, config.ErrMarkerMissing) {
2244 return err
2245 }
2246
2247 if err := ignore.WriteIgnores(cfg.Filesystem(), ".stignore", content); err != nil {
2248 slog.Error("Failed to save .stignore", slogutil.Error(err))
2249 return err
2250 }
2251
2252 m.mut.RLock()
2253 runner, ok := m.folderRunners.Get(cfg.ID)
2254 m.mut.RUnlock()
2255 if ok {
2256 runner.ScheduleScan()
2257 }
2258 return nil
2259}
2260
2261// OnHello is called when an device connects to us.
2262// This allows us to extract some information from the Hello message

Callers 2

handleAutoAcceptsMethod · 0.95
SetIgnoresMethod · 0.95

Calls 9

WriteIgnoresFunction · 0.92
ErrorFunction · 0.92
CheckPathMethod · 0.80
CreateRootMethod · 0.80
FilesystemMethod · 0.80
ErrorMethod · 0.65
GetMethod · 0.65
ScheduleScanMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected