This will: 1. prevent creation of a new .stignore if there are no ignore patterns 2. delete an existing .stignore if all ignore patterns are removed
This commit is contained in:
committed by
Jakob Borg
parent
0bec01b827
commit
b3fd9a8d53
@@ -545,6 +545,14 @@ func parseIgnoreFile(fs fs.Filesystem, fd io.Reader, currentFile string, cd Chan
|
||||
|
||||
// WriteIgnores is a convenience function to avoid code duplication
|
||||
func WriteIgnores(filesystem fs.Filesystem, path string, content []string) error {
|
||||
if len(content) == 0 {
|
||||
err := filesystem.Remove(path)
|
||||
if fs.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
fd, err := osutil.CreateAtomicFilesystem(filesystem, path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user