]> Cypherpunks.ru repositories - goredo.git/blobdiff - depfix.go
Storage optimisations for the same often used data
[goredo.git] / depfix.go
index b045682f3c03cfe9c6013a6532cc65a1a68560b5..87ecd882961cf8026d2398dc0dcf4a96bbbac2c9 100644 (file)
--- a/depfix.go
+++ b/depfix.go
@@ -18,6 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
+       "encoding/hex"
        "errors"
        "io"
        "io/fs"
@@ -110,7 +111,7 @@ func depFix(root string) error {
                                if err != nil {
                                        return ErrLine(err)
                                }
-                               theirHsh := m["Hash"]
+                               theirHsh := mustHexDecode(m["Hash"])
                                fd, err := os.Open(path.Join(root, dep))
                                if err != nil {
                                        if errors.Is(err, fs.ErrNotExist) {
@@ -148,7 +149,7 @@ func depFix(root string) error {
                                if err != nil {
                                        return ErrLine(err)
                                }
-                               if hsh != theirHsh {
+                               if hsh != string(theirHsh) {
                                        tracef(
                                                CDebug, "depfix: %s/%s -> %s: hash differs",
                                                root, entry.Name(), dep,
@@ -158,7 +159,7 @@ func depFix(root string) error {
                                fields = []recfile.Field{
                                        {Name: "Type", Value: DepTypeIfchange},
                                        {Name: "Target", Value: dep},
-                                       {Name: "Hash", Value: hsh},
+                                       {Name: "Hash", Value: hex.EncodeToString([]byte(hsh))},
                                }
                                fields = append(fields, inode.RecfileFields()...)
                                fieldses[len(fieldses)-1] = fields