Skip to content

Commit

Permalink
Add .git/info/exclude to default ignore files (#106)
Browse files Browse the repository at this point in the history
* Add `.git/info/exclude` to default ignore files

* Update README
  • Loading branch information
caitlinelfring authored Jul 21, 2021
1 parent c59bc0e commit 5b45f81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ ignore_files:
- globs/too/*
```
`woke` will also automatically ignore anything listed in `.gitignore`.
`woke` will also automatically ignore anything listed in `.gitignore` and `.git/info/exclude`.

#### `.wokeignore`

Expand Down
13 changes: 10 additions & 3 deletions pkg/ignore/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ type Ignore struct {
matcher *gitignore.GitIgnore
}

// NewIgnore produces an Ignore object, with compiled lines from .gitignore and DefaultIgnores
var defaultIgnoreFiles = []string{
".gitignore",
".wokeignore",
".git/info/exclude",
}

// NewIgnore produces an Ignore object, with compiled lines from defaultIgnoreFiles
// which you can match files against
func NewIgnore(lines []string) *Ignore {
start := time.Now()
Expand All @@ -26,8 +32,9 @@ func NewIgnore(lines []string) *Ignore {
Msg("finished compiling ignores")
}()

lines = append(lines, readIgnoreFile(".gitignore")...)
lines = append(lines, readIgnoreFile(".wokeignore")...)
for _, filename := range defaultIgnoreFiles {
lines = append(lines, readIgnoreFile(filename)...)
}

ignorer := Ignore{
matcher: gitignore.CompileIgnoreLines(lines...),
Expand Down

0 comments on commit 5b45f81

Please sign in to comment.