Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aafce9eba7 |
@@ -1997,7 +1997,7 @@ func (s *Scanner) detectDeletedFiles(
|
|||||||
|
|
||||||
// excludedOrInExcludedDir reports whether filePath, which is at or
|
// excludedOrInExcludedDir reports whether filePath, which is at or
|
||||||
// beneath rootPath, or any directory between rootPath and it, matches an
|
// beneath rootPath, or any directory between rootPath and it, matches an
|
||||||
// exclude pattern. A pattern such as **/node_modules matches the
|
// exclude pattern. A pattern such as */.local/share/Trash matches the
|
||||||
// directory but not the files inside it, which the walk skips too.
|
// directory but not the files inside it, which the walk skips too.
|
||||||
func (s *Scanner) excludedOrInExcludedDir(filePath, rootPath string) bool {
|
func (s *Scanner) excludedOrInExcludedDir(filePath, rootPath string) bool {
|
||||||
for p := filePath; len(p) > len(rootPath); p = filepath.Dir(p) {
|
for p := filePath; len(p) > len(rootPath); p = filepath.Dir(p) {
|
||||||
|
|||||||
@@ -121,14 +121,14 @@ func TestBackupDoesNotCountFileInExcludedDirectoryAsDeleted(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
env := newDeletedCountEnv(t, map[string][]byte{
|
env := newDeletedCountEnv(t, map[string][]byte{
|
||||||
"top.txt": []byte("top"),
|
"top.txt": []byte("top"),
|
||||||
"app/node_modules/dep.js": []byte("dep"),
|
"user/.local/share/Trash/old.txt": []byte("old"),
|
||||||
})
|
})
|
||||||
env.setSnapshot("home", "")
|
env.setSnapshot("home", "")
|
||||||
|
|
||||||
assert.Contains(t, env.backUp(t, "home"), filesLine(2, 2, 0))
|
assert.Contains(t, env.backUp(t, "home"), filesLine(2, 2, 0))
|
||||||
|
|
||||||
env.setSnapshot("home", "", "**/node_modules")
|
env.setSnapshot("home", "", "*/.local/share/Trash")
|
||||||
assert.Contains(t, env.backUp(t, "home"), filesLine(1, 0, 1))
|
assert.Contains(t, env.backUp(t, "home"), filesLine(1, 0, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user