]> Sergey Matveev's repositories - glocate.git/blobdiff - diff.go
Nullify directory sizes before DirSizer
[glocate.git] / diff.go
diff --git a/diff.go b/diff.go
index 31712d63aaff055dea895b639dbc85323a6ab1e46d393ae7a232f2a4b80d9f1d..181f5c3ee94b6acbe65d9b29786325b881e0d221b7af78d7481638beacbcf832 100644 (file)
--- a/diff.go
+++ b/diff.go
@@ -61,6 +61,7 @@ func updateWithDiff(dbPath, strip string) *os.File {
                }
                isDir = cols[1] == "/"
                name := deoctalize(strings.TrimPrefix(cols[2], strip))
+               name = strings.TrimRight(name, "/")
                if name == "" {
                        continue
                }
@@ -222,6 +223,9 @@ func updateWithDiff(dbPath, strip string) *os.File {
                        ent.size = mods[0].size
                        mods = mods[1:]
                }
+               if ent.IsDir() {
+                       ent.size = 0
+               }
                entsDirSizer <- ent
        }
        for len(adds) > 0 {