]> Sergey Matveev's repositories - glocate.git/blobdiff - diff.go
Raise copyright years
[glocate.git] / diff.go
diff --git a/diff.go b/diff.go
index 31712d63aaff055dea895b639dbc85323a6ab1e46d393ae7a232f2a4b80d9f1d..15de2cde8a6963476915f84f26a69044160d6aa7cf27ce732082a37292257fd4 100644 (file)
--- a/diff.go
+++ b/diff.go
@@ -1,3 +1,20 @@
+/*
+glocate -- ZFS-diff-friendly locate-like utility
+Copyright (C) 2022-2023 Sergey Matveev <stargrave@stargrave.org>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
 package main
 
 import (
@@ -61,6 +78,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 +240,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 {