X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=diff.go;h=ca424c43668db907b610923b26bbe1069c33c9352b61d4c8a207dbb34e6fee14;hb=HEAD;hp=31712d63aaff055dea895b639dbc85323a6ab1e46d393ae7a232f2a4b80d9f1d;hpb=e796780ae74b49e3a44ec2c20dfb3b22fa3c7916aa96d2e27937f5658eea2b6b;p=glocate.git diff --git a/diff.go b/diff.go index 31712d6..ca424c4 100644 --- a/diff.go +++ b/diff.go @@ -1,3 +1,18 @@ +// glocate -- ZFS-diff-friendly locate-like utility +// Copyright (C) 2022-2024 Sergey Matveev +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + package main import ( @@ -61,6 +76,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 +238,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 {