X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=run.go;h=0b77d499613f5549704b528fbfff49b440282ebd;hb=dec78abffe14ae2e7c3383c215803c3792788d3e;hp=3e6cd35fdbe5a3e41c2167b4436bca1f1840a7a6;hpb=b42c8c2dba5ea7667c32681338930969ed5c1cdb;p=goredo.git diff --git a/run.go b/run.go index 3e6cd35..0b77d49 100644 --- a/run.go +++ b/run.go @@ -683,7 +683,7 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { fd = fdStdout } - // Do we need to ifcreate it, of ifchange with renaming? + // Do we need to ifcreate it, or ifchange with renaming? if fd == nil { os.Remove(path.Join(cwdOrig, tgt)) err = ifcreate(fdDep, tgt) @@ -731,6 +731,26 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { goto Finish } } + + // Post-commit .rec sanitizing + fdDep.Close() + if fdDepR, err := os.Open(fdDepPath); err == nil { + depInfo, err := depRead(fdDepR) + fdDepR.Close() + if err != nil { + goto Finish + } + ifchangeSeen := make(map[string]struct{}, len(depInfo.ifchanges)) + for _, dep := range depInfo.ifchanges { + ifchangeSeen[dep["Target"]] = struct{}{} + } + for _, dep := range depInfo.ifcreates { + if _, exists := ifchangeSeen[dep]; exists { + tracef(CWarn, "simultaneous ifcreate and ifchange records: %s", tgt) + } + } + } + Finish: runErr.Err = err errs <- runErr