doc/news.texi | 8 ++++++++ run.go | 20 ++++++++++++++++++++ t/goredo-both-ifcreate-ifchange.t | 15 +++++++++++++++ usage.go | 2 +- diff --git a/doc/news.texi b/doc/news.texi index 1471d26fd037dab0cb3f09f55cc145fbf376c946bfa9381efb2e0011a1cb1d47..a7fcb4cf9edaba645b01b437edd4d70bf84dffe42c168f50c91716ad1dd639be 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -1,6 +1,14 @@ @node News @unnumbered News +@anchor{Release 1_20_0} +@section Release 1.20.0 +@itemize +@item + Print warning message if both ifcreate and ifchange records were + discovered after the target is done. +@end itemize + @anchor{Release 1_19_0} @section Release 1.19.0 @itemize diff --git a/run.go b/run.go index 7086704112aa372c9bc1647ea4b57b2aacaa4d31cc792d395f6896a3b5eb5ff1..f5cf3c3d04ad8dcd742c5ad61c15afa5396991a4a03aa09b5b72e415a08e5e7a 100644 --- a/run.go +++ b/run.go @@ -731,6 +731,26 @@ if err != nil { 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 diff --git a/t/goredo-both-ifcreate-ifchange.t b/t/goredo-both-ifcreate-ifchange.t new file mode 100755 index 0000000000000000000000000000000000000000..df15e81e014a23c0ca0a5efeca0974c90af8da55ea842076c5d9756b180d7287 --- /dev/null +++ b/t/goredo-both-ifcreate-ifchange.t @@ -0,0 +1,15 @@ +#!/bin/sh + +testname=`basename "$0"` +test_description="Check that warning exists when using both ifcreate/ifchange" +. $SHARNESS_TEST_SRCDIR/sharness.sh +export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1 + +touch src +echo redo-ifchange src > tgt.do +echo redo-ifcreate src >> tgt.do +redo tgt 2>2 + +test_expect_success "warn exists" 'grep -q "simultaneous ifcreate and ifchange" 2' + +test_done diff --git a/usage.go b/usage.go index 574731c540a3d0d4cbcc01a7ea2c5a97e6716e6ddeea3c03d7ca9c15fd8eb36b..96768264651756bd1e240d303f4d1abde6440a501417a012968a49d9e545f4c5 100644 --- a/usage.go +++ b/usage.go @@ -24,7 +24,7 @@ "os" ) const ( - Version = "1.19.0" + Version = "1.20.0" Warranty = `Copyright (C) 2020-2021 Sergey Matveev This program is free software: you can redistribute it and/or modify