File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
frontend/dockerfile/dockerignore Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -10,19 +10,29 @@ import (
1010 "github.com/pkg/errors"
1111)
1212
13- // ReadAll reads a .dockerignore file and returns the list of file patterns
14- // to ignore. Note this will trim whitespace from each line as well
15- // as use GO's "clean" func to get the shortest/cleanest path for each.
13+ // ReadAll reads an ignore file from a reader and returns the list of file
14+ // patterns to ignore, applying the following rules:
15+ //
16+ // - An UTF8 BOM header (if present) is stripped.
17+ // - Lines starting with "#" are considered comments and are skipped.
18+ //
19+ // For remaining lines:
20+ //
21+ // - Leading and trailing whitespace is removed from each ignore pattern.
22+ // - It uses [filepath.Clean] to get the shortest/cleanest path for
23+ // ignore patterns.
24+ // - Leading forward-slashes ("/") are removed from ignore patterns,
25+ // so "/some/path" and "some/path" are considered equivalent.
1626func ReadAll (reader io.Reader ) ([]string , error ) {
1727 if reader == nil {
1828 return nil , nil
1929 }
2030
21- scanner := bufio .NewScanner (reader )
2231 var excludes []string
2332 currentLine := 0
24-
2533 utf8bom := []byte {0xEF , 0xBB , 0xBF }
34+
35+ scanner := bufio .NewScanner (reader )
2636 for scanner .Scan () {
2737 scannedBytes := scanner .Bytes ()
2838 // We trim UTF8 BOM
You can’t perform that action at this time.
0 commit comments