]> Cypherpunks.ru repositories - goredo.git/blobdiff - depfix.go
Download link for 2.6.2 release
[goredo.git] / depfix.go
index 1d1bdea13355334d4ec3c34ae5e2a145802d040a..0ffacf6ca17a42a2c89ecca13621956a75d17f99 100644 (file)
--- a/depfix.go
+++ b/depfix.go
@@ -1,19 +1,17 @@
-/*
-goredo -- djb's redo implementation on pure Go
-Copyright (C) 2020-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/>.
-*/
+// goredo -- djb's redo implementation on pure Go
+// Copyright (C) 2020-2024 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
 
@@ -156,7 +154,7 @@ func depFix(root string) error {
                                                if err != nil {
                                                        break
                                                }
-                                               var inode Inode
+                                               var inode *Inode
                                                inode, _, err = inodeFromFileByFd(fd)
                                                if err != nil {
                                                        fd.Close()
@@ -174,12 +172,12 @@ func depFix(root string) error {
                                                _, err = io.Copy(fdDepW, bytes.NewBuffer(
                                                        chunkWrite(bytes.Join([][]byte{
                                                                {DepTypeIfchange},
-                                                               []byte(inode),
+                                                               inode[:],
                                                                []byte(hsh),
                                                                []byte(name),
                                                        }, nil))))
-                                       case DepTypeIfchangeDummy:
-                                               err = depWriteDummy(fdDepW, fdDep.Name(), string(chunk))
+                                       case DepTypeIfchangeNonex:
+                                               err = depWriteNonex(fdDepW, fdDep.Name(), string(chunk))
                                        }
                                        if err != nil {
                                                return ErrLine(err)
@@ -234,7 +232,7 @@ func depFix(root string) error {
                                                err = ifcreate(fdDepW, fdDep.Name(), m["Target"])
                                        case "ifchange":
                                                if m["Size"] == "" {
-                                                       err = depWriteDummy(fdDepW, fdDep.Name(), m["Target"])
+                                                       err = depWriteNonex(fdDepW, fdDep.Name(), m["Target"])
                                                        break
                                                }
                                                name := string(m["Target"])
@@ -244,7 +242,7 @@ func depFix(root string) error {
                                                if err != nil {
                                                        break
                                                }
-                                               var inode Inode
+                                               var inode *Inode
                                                inode, _, err = inodeFromFileByFd(fd)
                                                if err != nil {
                                                        fd.Close()
@@ -262,7 +260,7 @@ func depFix(root string) error {
                                                _, err = io.Copy(fdDepW, bytes.NewBuffer(
                                                        chunkWrite(bytes.Join([][]byte{
                                                                {DepTypeIfchange},
-                                                               []byte(inode),
+                                                               inode[:],
                                                                []byte(hsh),
                                                                []byte(name),
                                                        }, nil))))