mirror of
https://github.com/octoleo/syncthing.git
synced 2025-03-21 10:12:21 +00:00
Add comments directive to ignores
This commit is contained in:
parent
760a9d6d35
commit
d96ce23451
@ -122,6 +122,8 @@ func parseIgnoreFile(fd io.Reader, currentFile string, seen map[string]bool) (Pa
|
|||||||
switch {
|
switch {
|
||||||
case line == "":
|
case line == "":
|
||||||
continue
|
continue
|
||||||
|
case strings.HasPrefix(line, "//"):
|
||||||
|
continue
|
||||||
case strings.HasPrefix(line, "#"):
|
case strings.HasPrefix(line, "#"):
|
||||||
err = addPattern(line)
|
err = addPattern(line)
|
||||||
case strings.HasSuffix(line, "/**"):
|
case strings.HasSuffix(line, "/**"):
|
||||||
|
@ -133,3 +133,21 @@ func TestCaseSensitivity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCommentsAndBlankLines(t *testing.T) {
|
||||||
|
stignore := `
|
||||||
|
// foo
|
||||||
|
//bar
|
||||||
|
|
||||||
|
//!baz
|
||||||
|
//#dex
|
||||||
|
|
||||||
|
// ips
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
pats, _ := ignore.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||||
|
if len(pats) > 0 {
|
||||||
|
t.Errorf("Expected no patterns")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user