]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Log inode trust only on top level redo
[goredo.git] / run.go
diff --git a/run.go b/run.go
index 903a063c283b53136eb5475ac15f5d05c9a6388e..ecf96e22e5428e44eeee29ef6de329d33689c0dd 100644 (file)
--- a/run.go
+++ b/run.go
@@ -21,7 +21,6 @@ package main
 
 import (
        "bufio"
-       "bytes"
        "crypto/rand"
        "encoding/hex"
        "errors"
@@ -134,7 +133,7 @@ func mkdirs(pth string) error {
 }
 
 func isModified(depInfo *DepInfo, tgt *Tgt) (
-       modified bool, ourInode *Inode, hshPrev []byte, err error,
+       modified bool, ourInode *Inode, hshPrev Hash, err error,
 ) {
        if depInfo == nil {
                return
@@ -355,7 +354,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                }
        }
 
-       if err = depWrite(fdDep, tgt.h, doFile, nil); err != nil {
+       if err = depWrite(fdDep, tgt.h, doFile, ""); err != nil {
                cleanup()
                return TgtError{tgt, ErrLine(err)}
        }
@@ -666,11 +665,6 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                errs <- runErr
                                return
                        }
-                       if err != nil {
-                               runErr.Err = err
-                               errs <- runErr
-                               return
-                       }
                        if !inode.Equals(inodePrev) {
                                runErr.Err = Err1WasTouched
                                errs <- runErr
@@ -722,8 +716,8 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                goto Finish
                        }
                } else {
-                       var hsh []byte
-                       if hshPrev != nil {
+                       var hsh Hash
+                       if hshPrev != "" {
                                _, err = fd.Seek(0, io.SeekStart)
                                if err != nil {
                                        err = ErrLine(err)
@@ -734,7 +728,7 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
                                        err = ErrLine(err)
                                        goto Finish
                                }
-                               if bytes.Equal(hsh, hshPrev) {
+                               if hsh == hshPrev {
                                        tracef(CDebug, "%s has same hash, not renaming", tgt)
                                        err = ErrLine(os.Remove(fd.Name()))
                                        if err != nil {