ephemeral.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package ignore
  2. import (
  3. "github.com/windmilleng/tilt/internal/dockerignore"
  4. "github.com/windmilleng/tilt/pkg/model"
  5. )
  6. // Filter out spurious changes that we don't want to rebuild on, like IDE
  7. // temp/lock files.
  8. //
  9. // This isn't an ideal solution. In an ideal world, the user would put
  10. // everything to ignore in their tiltignore/dockerignore files. This is a
  11. // stop-gap so they don't have a terrible experience if those files aren't
  12. // there or aren't in the right places.
  13. //
  14. // https://app.clubhouse.io/windmill/story/691/filter-out-ephemeral-file-changes
  15. var ephemeralPathMatcher = initEphemeralPathMatcher()
  16. func initEphemeralPathMatcher() model.PathMatcher {
  17. golandPatterns := []string{"**/*___jb_old___", "**/*___jb_tmp___", "**/.idea/**"}
  18. emacsPatterns := []string{"**/.#*"}
  19. vimPatterns := []string{"**/4913", "**/*~", "**/.*.swp", "**/.*.swx"}
  20. allPatterns := []string{}
  21. allPatterns = append(allPatterns, golandPatterns...)
  22. allPatterns = append(allPatterns, emacsPatterns...)
  23. allPatterns = append(allPatterns, vimPatterns...)
  24. matcher, err := dockerignore.NewDockerPatternMatcher("/", allPatterns)
  25. if err != nil {
  26. panic(err)
  27. }
  28. return matcher
  29. }