Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make include_file overrule include_ext #358

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions runner/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (e *Engine) cacheFileChecksums(root string) error {
}
}

if e.isExcludeFile(path) || !e.isIncludeExt(path) {
if e.isExcludeFile(path) || !e.isIncludeExt(path) && !e.checkIncludeFile(path) {
e.watcherDebug("!exclude checksum %s", e.config.rel(path))
return nil
}
Expand Down Expand Up @@ -251,7 +251,7 @@ func (e *Engine) watchPath(path string) error {
if excludeRegex {
break
}
if !e.isIncludeExt(ev.Name) {
if !e.isIncludeExt(ev.Name) && !e.checkIncludeFile(path) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the argument here may need to be ev.Name, I will re-verify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the argument here may need to be ev.Name, I will re-verify.

I test the code below, it's ok:

if !e.isIncludeExt(ev.Name) && !e.checkIncludeFile(ev.Name) {

I don't know, why marked this pull request as draft, can i recreate new pull request base on the code?

break
}
e.watcherDebug("%s has changed", e.config.rel(ev.Name))
Expand Down Expand Up @@ -317,7 +317,7 @@ func (e *Engine) start() {
e.mainDebug("exit in start")
return
case filename = <-e.eventCh:
if !e.isIncludeExt(filename) {
if !e.isIncludeExt(filename) && !e.checkIncludeFile(filename) {
continue
}
if e.config.Build.ExcludeUnchanged {
Expand Down
2 changes: 1 addition & 1 deletion runner/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ func TestShouldIncludeIncludedFile(t *testing.T) {
[build]
cmd = "true" # do nothing
full_bin = "sh main.sh"
include_ext = ["sh"]
include_ext = []
include_dir = ["nonexist"] # prevent default "." watch from taking effect
include_file = ["main.sh"]
`
Expand Down