Skip to content

Commit ce61e7b

Browse files
nicksmilas
authored andcommitted
ignore: improve the ephemeral temp file patterns [ch2663] (docker#1925)
1 parent 267cde9 commit ce61e7b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pkg/watch/ephemeral.go

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

0 commit comments

Comments
 (0)